i have encoutered a problem where cobertura report does not cover all test cases, and i could not find a satisfactory answer on internet.
i have a main class:
public class SomeClass {
public Somereturn method1(){
//Something doing here
}
public Somereturn method2(){
//Something doing here
}
public Somereturn method3(){
//Something doing here
}
public Somereturn method4(){
//Something doing here
}
}
when I am preparing test case for first or second method cobertura will identify its coverage :
public testclass {
@Test
Public void test1mehtod1(){
// testing mothod1 for some scenario
}
@Test
Public void test2mehtod1(){
// testing mothod1 again for some other scenario
}
@Test
Public void test1mehtod2(){
// testing mothod2 some other scenario
}
}
this is identified by cobertura lets say 50 % coverage.
but if I choose last or second last method:
public testclass {
@Test
Public void test1mehtod3(){
// testing mothod3 for some scenario
}
@Test
Public void test1mehtod4(){
// testing mothod4 for some other scenario
}
}
It refused to identify coverage and shows only 0 % Coverage.
if I talk about reality, for one controller class I have covered 100% preparing all test cases. but cobertura only shows 22% coverage . I am working on a sprintboot application.