Must-share information (formatted with Markdown):
-
which versions are you using
sonarqube-8.6.0.39681 server to display Jacoco pertest coverage -
what are you trying to achieve
Need to enable per test coverage for unit tests through jacoco for my junit tests -
what have you tried so far to achieve this
I have created a Springboot project with some unit test to measure the per test coverage. I can see on the test coverage, but I can not get the jacoco per test coverage which actually give the link between the application code lines and the unit tests.
pom set up:
<java.version>1.8</java.version>
<sonar.language>java</sonar.language>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.coverage.jacoco.xmlReportPaths>{project.build.directory}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.jacoco.reportsPaths>{project.build.directory}/target/jacoco.exec</sonar.jacoco.reportsPaths>
<sonar.tests>src/test/java</sonar.tests>
<sonar.projectKey>sonar-test</sonar.projectKey>
<sonar.host.url>http://localhost:9000</sonar.host.url>
<sonar.login>admin</sonar.login>
<sonar.password>admin123</sonar.password>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.8.0.2131</version>
</dependency>
</dependencies>
</profile>
</profiles>