What is the advantage of instruction (byte code) coverage over line and branch coverage?

by Thunderforge   Last Updated July 17, 2017 15:05 PM

Our project uses Jacoco for code coverage metrics. Previously, we have checked the line and branch coverage against percentage values. However, the documentation also describes an "Instructions" level, which counts Java byte code instructions. From their documentation:

The smallest unit JaCoCo counts are single Java byte code instructions. Instruction coverage provides information about the amount of code that has been executed or missed. This metric is completely independent from source formatting and always available, even in absence of debug information in the class files.

If we have been using line and branch coverage previously, what is the advantage of switching to instruction coverage? Is it just counting the same things in a different way? Or does it provide more accurate metrics? Conversely, is there a situation where we would want to use line and branch coverage metrics instead of byte code?

Tags : test-coverage

Related Questions

Which is the least evil

Updated August 27, 2018 13:05 PM

Switch coverage in use

Updated September 14, 2016 09:02 AM