What is the color and number next to the line number in cobertura report

I used mvn cobertura: cobertura to generate this coverage report for JUnit coberra. Can someone explain to me what the numbers next to the line number mean? Thank.

enter image description here

+4
source share
1 answer

These numbers correspond to how many times this line was executed during your tests. Using a simple example:

public class MyClass {
    public void methodA(){
        System.out.println("Method a");
    }

    public void methodB(){
        System.out.println("Method b");
    }
}

With some tests:

public class MyClassTest {

    @Test
    public void testMethodA(){
        final MyClass x = new MyClass();
        x.methodA();
    }

    @Test
    public void testMethodB(){
        final MyClass x = new MyClass();
        x.methodB();
    }
}

I will get the following report showing that I created my test object twice and ran each method each time: Not ignored test case

@Ignore testMethodB, , , methodB : enter image description here

. , , .

. , - . , :

public void methodB(final boolean testOne, final boolean testTwo){
    if(testOne || testTwo){
        System.out.println("Method b");
    }
    System.out.println("Done");
}

:

@Test
    public void testMethodB(){
        final MyClass x = new MyClass();
        x.methodB(true, false);
        x.methodB(true, true);
    }

. , , ( 2 ), , , .

conditional coverage

+4

Source: https://habr.com/ru/post/1658477/


All Articles