Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 49 Next »

It is possible to feed SonarQube with code coverage reports from JaCoCo, Cobertura and Clover.

Project samples covering the different cases below are available on github that can be browsed or downloadedprojects/languages/java/code-coverage

 See Component Viewer on Unit Test File or Quality Flows > Lack of Unit Tests to browse the results in the web interface.

Reusing Existing Reports

Every analyzer supports the reuse reports mode.

To be reused by SonarQube:

  • The tests execution reports have to comply to the JUnit XML format.
  • The code coverage reports have to be generated by JaCoCoCobertura or Clover.

First, tell SonarQube to reuse existing reports:

With Maven in your pom.xml file:

With Ant in your build.xml file:

With SonarQube Runner in your sonar-project.properties file:

Test Execution Reports

Tell SonarQube where your unit tests execution reports are: absolute or relative path to the directory containing your reports

With Maven in your pom file:

With Ant in your build file:

With SonarQube Runner in your sonar-project.properties file:

Code Coverage Report 

First, tell SonarQube which code coverage engine has been used to generate the reports: jacoco, cobertura or clover.

Then, tell SonarQube where to get the code coverage reports.

With Maven in your pom file:

With Ant in your build file:

With SonarQube Runner in your sonar-project.properties file:

Depending on the code coverage tool you used to generate your report, replace jacoco by cobertura or clover in the property name.

  • No labels