Skip to content Skip to sidebar Skip to footer

Sonarqube Overall Coverage Does Not Match Jacoco Report Coverage

I have a multi-module Android project and I'm seeing a discrepancy between the coverage that jacoco reports and what Sonarqube reports. The project is also a multi-flavor project

Solution 1:

As far as I can see branch coverage is the same: 40% in both cases, 15 uncovered.

And comparison of "instructions" (shown in screenshot of JaCoCo report) with anything else is like comparison of apples and oranges - they don't represent the same thing. See http://www.eclemma.org/jacoco/trunk/doc/counters.html about counters that JaCoCo provides. And https://docs.sonarqube.org/latest/user-guide/metric-definitions about what SonarQube shows. Instructions coverage is presented only in JaCoCo.

"lines" ("27.1%" shown in screenshot of SonarQube) is not the same as "instructions": Single line of code usually contains many bytecode instructions. So for example if in total you have 100 instructions in 10 lines and cover 1 line with 20 instructions, then missed instructions 80%, but missed lines 90%.

So all in all, there is no discrepancy or at least it is not shown on your screenshots.

Post a Comment for "Sonarqube Overall Coverage Does Not Match Jacoco Report Coverage"