Instructions coverage vs line coverage

4,226 views
Skip to first unread message

Vicki Kozel

unread,
Nov 29, 2012, 1:40:40 PM11/29/12
to jac...@googlegroups.com
Hello,
I am implementing Jacoco code coverage in my organization; I love Jacoco reliability and ease of use. The only question I have is about instruction coverage. Jacoco uses this counter rather than the line coverage counter, but how can a developer make use of such metric? If a line contains multiple instructions and not all of them are covered - it is not going to appear covered in the report (am I mistaken?) But in a developer's mind, his test is hitting this line for sure. At the end, the reports show the line of sorce code, not the byte code instruction. I did some experiments with Cobertura and Jacoco side-by-side, and from those experiments I remember that the number of instructions in Jacoco was roughly equivalent to the number of lines in Cobertura.... Any thoughts?

Thank you!
Vicki

Marc R. Hoffmann

unread,
Dec 2, 2012, 11:36:25 AM12/2/12
to jac...@googlegroups.com
Hi Vicki,

please see documentation for exact definitions of JaCoCO metrics:

http://www.eclemma.org/jacoco/trunk/doc/counters.html

> Jacoco uses this counter rather than the line coverage counter

JaCoCo shows both counters in its reports. If line counters are missing
your class files are probably not compiled with debug information,
please check our FAQ:

http://www.eclemma.org/jacoco/trunk/doc/faq.html

> I remember that the number of instructions in Jacoco
> was roughly equivalent to the number of lines in Cobertura.

If this is the case either JaCoCo or Cobertura has a serious bug.

Best regards,
-marc
> --
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages