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?
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.
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.
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.
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 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With