Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coverage color meaning in eclipse

I have source code (java language) in eclipse. Then I check the coverage. I give 4 as the input. But I don't know what's the meaning of the color (red, yellow, and green). This is the code(ifElse.java):

code coverage in eclipse

Then what's the meaning of Statement 80%, Branch 50%, and Term 50%? How to calculate it? Thank you.

like image 708
dev-x Avatar asked Oct 13 '16 09:10

dev-x


1 Answers

Green means your tests have run through those instructions.

Yellow means your tests have run through those instructions, but not all of possible cases have been covered.

If you have this simple conditional:

if(i>2) <- yellow

It means your tests covered a value of i either less than 2 or greater than two, but not two of them. In such case you must to think of 2 different "scenarios" which usually means two different tests.

Red means none of your tests reached those instructions.

like image 67
isah Avatar answered Sep 28 '22 05:09

isah