Jacoco code coverage reports are not generated for integration tests, and are not displayed in sonar
I have constructed Jacoco + Sonar in Maven. I can generate unit test coverage reports and show coverage in Sonar. But failed to generate reports for integration tests. "jacoco-it.exec" is generated, but when I go and open index.html it looks blank. But there are many integration tests that have been performed and passed on. The jacoco-sessions.html clearly states all the classes that are used internally. Please help me if you have any ideas what is wrong in the code below on integration tests. I also configured Sonar correctly and gave a path to get results for the integration tests. Please take a look once and help me if you have any ideas. pom.xml:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
<dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals> </execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>${project.build.directory}/coverage-reports/jacoco-it.exec</jacoco-agent.destfile>
</systemPropertyVariables>
<encoding>UTF-8</encoding>
<skipTests>false</skipTests>
<runOrder>alphabetical</runOrder>
<includes>
....<There are integration tests>
</includes>
<excludes>
....
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
+3
source to share
No one has answered this question yet
Check out similar questions: