Code coverage clarifications

We are using sonarqube 7.1 community version. We are running a jenkins pipeline which uses jacoco to collect code coverage data. The sonarqube dashboard states that code coverage is at 88.2%. However, when I go to the drill down page and manually calculate the average, the result comes to 93%. I would like to better understand how code coverage is generated and why the numbers are not matching up.

The reason we are asking is because we are also using api’s to collect the data for the sonarqube scans which will be displayed on a dashboard. We notice there are some discrepancies between what is displayed on the SonarQube dashboard vs our dashboard which is collecting the data via api’s. We want to ensure that both dashboards are showing valid data, and they are both the same.

Any information on how code coverage is calculated and why they do not match the manual calculation would be greatly appreciated.

Hi @nchoudhu ,

Please Metric Definitions | SonarQube Docs and the Tests section for more details.

Also, please upgrade to our latest version of SonarQube or at least the SonarQube 8.9 LTS version. Your version of SonarQube is outdated and not supported anymore.

Joe