Publish Code Coverage to SonarQube
You will see how to publish code coverage to SonarQube in 2 simple steps.
- Enable “xml” parameter in rktracer configuration file to generate SonarQube xml file.
- Set reports path in sonar properties file to SonarQube xml file in project .
When you generate RKTracer code coverage reports, you need to use the following parameter along with the report generate command.
rkresults -xml
With the above command, the RKTracer tool will generate two XML reports.
rktracer.xml for Jenkins
rktracer-sonarqube.xml for SonarQube
To publish code coverage to sonarqube, you need to edit the project properties file and add the following details.
sonar.exclusions=rktracer/**
sonar.language=java
sonar.java.binaries=target/classes
sonar.coverageReportPaths=/home/user/project-path/rktracer/report/rktracer-sonarqube.xml
Then run sonar scanner to publish code coverage data to SonarQube