Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does jacoco yellow line mean

Tags:

java

jacoco

I am trying to measure my code coverage using jacoco, but I dont understand the meaning of the yellow lines. The document says that it is for a condition which is not fully covered. But see the coverage snapshot I got - it is evident that the condition is hit because the subsequent line is green, so why is the condition marked as yellow?

screen-shot

Also, if you can point to a quick reference to what all coverage items that jacoco can show (besides line coverage) that will help a lot.

like image 395
R71 Avatar asked Jan 08 '15 15:01

R71


People also ask

What is yellow line in Junit coverage?

Green means that this line of code has been executed by the tests and are “covered.” Yellow indicates a segment of code that has multiple branches and that not all the branches in code have been reached (i.e. an if statement). Red indicates that this line of code has not been reached at all and as such is not covered.

What is JaCoCo line coverage?

JaCoCo mainly provides three important metrics: Lines coverage reflects the amount of code that has been exercised based on the number of Java byte code instructions called by the tests. Branches coverage shows the percent of exercised branches in the code, typically related to if/else and switch statements.

What does JaCoCo stand for?

JaCoCo stands for Java Code Coverage. It is a free code coverage library for Java, which has been created by the EclEmma team. It creates code coverage reports and integrates well with IDEs like IntelliJ IDEA, Eclipse IDE, etc.

Why does JaCoCo not show coverage?

Why does the coverage report not show highlighted source code? Make sure the following prerequisites are fulfilled to get source code highlighting in JaCoCo coverage reports: Class files must be compiled with debug information to contain line numbers. Source files must be properly supplied at report generation time.


1 Answers

Take a look here: http://www.eclemma.org/jacoco/trunk/doc/counters.html:

Partial coverage: Only a part of the instruction in the line have been executed

To turn green the condition should have been performed twice, one with false and one with true result. Probably your args.equals("0") always is true.

like image 116
Victor Avatar answered Oct 08 '22 21:10

Victor