Elements of branch coverage

19 views
Skip to first unread message

Alexandra

unread,
May 18, 2026, 11:27:26 AMMay 18
to JaCoCo and EclEmma Users
Hello,

I am interested in the use of JaCoCo for spectrum-based fault localization, especially the branch coverage. However, when testing JaCoCo on a small example, I see that the results are given only in terms of the execution counts. 
Screenshot from 2026-05-18 17-11-53.png
The XML file provides more information (mi/ci/mb/cb) but only specifies the source of the branches, not the target. E.g.,
<line nr="11" mi="0" ci="5" mb="1" cb="1"/>

In this case, we can see that branch (11,12) is missed and (11,13) is covered, but I assume that JaCoCo must record the specific branches to ensure that all of them are covered. If I could get any advice on where to find the branch elements in JaCoCo, it would be greatly appreciated.

Kind regards,
Alexandra

Marc Hoffmann

unread,
May 18, 2026, 11:44:52 AMMay 18
to jac...@googlegroups.com
Hi Alexandra,

JaCoCo works on compiled Java byte code. So internally it knows about the exact branches of the byte code execution flow. As there is no trivial mappingback  to the source code we do not report this information.

Long time ago there was a prototype to reconstruct this information from additional information that the Java compiler can adds to class files (CharacterRangeTable):


Please also note that JaCoCo does not track execution count. It only tracks whether instructions and branches are executed at least once.

Best regards,
-marc


On 18. May 2026, at 17:13, Alexandra <alexand...@gmail.com> wrote:

Hello,

I am interested in the use of JaCoCo for spectrum-based fault localization, especially the branch coverage. However, when testing JaCoCo on a small example, I see that the results are given only in terms of the execution counts. 
<Screenshot from 2026-05-18 17-11-53.png>
The XML file provides more information (mi/ci/mb/cb) but only specifies the source of the branches, not the target. E.g.,
<line nr="11" mi="0" ci="5" mb="1" cb="1"/>

In this case, we can see that branch (11,12) is missed and (11,13) is covered, but I assume that JaCoCo must record the specific branches to ensure that all of them are covered. If I could get any advice on where to find the branch elements in JaCoCo, it would be greatly appreciated.

Kind regards,
Alexandra

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jacoco/0ec9b706-81d5-4a00-856b-1490d4dbfd37n%40googlegroups.com.
<Screenshot from 2026-05-18 17-11-53.png>

Alexandra

unread,
May 22, 2026, 4:43:09 AMMay 22
to JaCoCo and EclEmma Users
Hi Marc,

Thanks for the quick reply! That makes sense, I'll have a look at that prototype.
Could I ask what the numbers in mi/ci then correspond to? E.g., in the above and for four test cases, we have mi=0 and ci=5 for line 11. There's also
<line nr="16" mi="0" ci="2" mb="0" cb="0"/>
This is for my own curiosity more than anything, since in the fault localization case, it only matters whether something is covered or not :)

Kind regards,
Alexandra

Marc Hoffmann

unread,
May 22, 2026, 4:53:20 AMMay 22
to jac...@googlegroups.com
Hi Alexandra,

regarding the meaning of the numbers, please find documentation here:

So mi/ci is “missed instructions” and “covered instructions” where instructions refers to Java byte code instructions.

Best regards,
-marc



Reply all
Reply to author
Forward
0 new messages