Java test coverage
SonarQube supports the reporting of test coverage as part of the analysis of your Java project.
Adjust your setup
Add coverage in a single-module Maven project
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
</profile>Add coverage in a multi-module Maven project
Add coverage in a Gradle project
Coverage parameter can also be set in the UI
Related pages
Last updated
Was this helpful?

