Reputation: 899
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):
Then what's the meaning of Statement 80%, Branch 50%, and Term 50%? How to calculate it? Thank you.
Upvotes: 9
Views: 23393
Reputation: 333
Here is something you may find useful.
Green is for fully covered lines of code,
Yellow is for partly covered lines i.e. There may be some branches that missed to reach) and
Red is for lines that have not been executed at all.
Apart from these addition colored diamond are also shown and they have same meaning as above.
Upvotes: 1
Reputation: 5341
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.
Upvotes: 16