JACOCO and SonarQube Dashoard Coverage Report Difference

  • SonarQube Version - 7.9.6 and SonarScaner Version - 4.6.2.2472
  • To display Jacoco Coverage Report on SonarQube UI
  • Integrate SonarQube with Jenkins.

ISSUE I have Jenkins pipeline and build process is generating JACOCO code coverage report (
Instructions Cov - 38% and Missed Branches - 26% ). Now I have integrated SonarQube for code analysis with required analysis parameter. Code analysis is displaying with on SonarQube UI but coverage is not displaying correctly. It should display the coverage published by JACOCO report ( eg. 38%).

sonar.projectKey=****
sonar.login=****
sonar.password=****
sonar.sources=.
sonar.java.binaries=**/target/classes
sonar.host.url=****
sonar.java.coveragePlugin=jacoco
sonar.coverage.jacoco.xmlReportPaths=Path of jacoco.xml file

Expectation - Same coverage from Jacoco report (38%) should be displayed.

I also tried to publish same JACOCO report with other Code quality tool and it is displaying same coming from JACOCO.

Could you please suggest what can be the reason for not displaying the same coverage report.
OR there is any calculation happens on JACOCO report before displaying on SonarQube ?
OR there is any other level (like line, branch), which SonarQube displays the code coverage ?

Thanks,
Santosh Kumar

Hi @sonarqube1,

Yes, we do some calculations on the raw JaCoCo data. You can find the full set of coverage metrics here. In particular, the overall SonarQube coverage calculation is a combination of line coverage and condition coverage.

I hope this helps; please let me know if you need more details.

Regards,

Cameron.

1 Like

Thank you so much for your response Cameron !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.