Jacoco unit and integration tests code coverage


We are using sonarqube version 8.9 and jacoco-maven-plugin version 0.8.7.
We also use maven-sueerfire-plugin for unit tests and maven-failsafe-plugin for integration tests.

Maven config is the following:

<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml, target/site/jacoco-it/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

org.jacoco jacoco-maven-plugin ${jacoco.version} prepare-agent prepare-agent-integration report report-integration

The reported coverage in sonarqube seems to be showing the combined coverage of both unit and integration tests. However in the left menu, I can only see Unit Tests, when I click on this link I can see the number of unit tests. Is it also possible to show the number of integration tests ? Why are they not all together so we can have a full overview of test classes ?



Welcome to the community!

Yes, coverage from all types is aggregated.

This is labeled Unit Tests because that’s typically what the reports about the tests themselves cover. There’s not a way to have a second set of numbers that’s just about your ITs.


Hello Ann,

Thank you for your answer, however when I look under unit tests, I only see the unit tests listed, not the integration tests. Maybee it’s a detail but just want to make sure the coverage is accurate.

Kind regards,

Hi Lucas,

Coverage doesn’t have a lot to do with the test execution report.