Skip to end of metadata
Go to start of metadata

Overview

It is possible to feed SonarQube with tests execution and code coverage reports.

Prerequisites

SonarJava is going to reuse reports and not generate them, so before trying to configure your analysis to import these reports, you need to be sure they are correctly generated and not empty.

  • The tests execution reports have to comply to the JUnit XML format.
  • The code coverage reports have to be generated with JaCoCo

Usage

You need to give the path of test execution and code coverage reports using the following parameters.

Property

Scope

Example

Description

sonar.junit.reportPathsProject-widetarget/surefire-reports, myModule/target/surefire-reports

Import tests execution reports (Surefire XML format).

Set the property with a list of comma-separated paths to the directories containing the XML reports.

sonar.jacoco.reportPathsProject-widetarget/jacoco.exec, target/jacoco-it.exec (default)

Import JaCoCo code coverage reports.

Set the property to the path of the JaCoCo .exec reports, merge multiple reports.

(if you are using a version of SonarQube prior to 6.2 please use sonar.jacoco.reportPath property)

Further details on using JaCoCo are available in Usage of JaCoCo with SonarJava .

A note to Cobertura users

SonarJava does not support import of Cobertura coverage data. A sonar-cobertura plugin exists, however maintenance and support there is entirely community based. More generally speaking, also note that SonarQube provides a tool-agnostic generic solution: Generic Test Data .

  • No labels