未生成jacoco-ut.exec覆盖报告
Java 1.8。 Maven 3.8。我想生成Junit测试的覆盖报告。因此,我在POM.xml
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.4.201502262128</version>
<executions>
<execution>
<id>prepare-ut-agent</id>
<phase>process-test-classes</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
<propertyName>jacoco.agent.ut.arg</propertyName>
<append>true</append>
</configuration>
</execution>
<execution>
<id>prepare-it-agent</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<propertyName>jacoco.agent.it.arg</propertyName>
<append>true</append>
</configuration>
</execution>
</executions>
</plugin>
开放终端中使用此操作,并以此方式运行测试:
mvn test -Dtest=com.my_company.myproject.ComponentServiceTest
测试成功完成。但是要生成的报道报告。文件jacoco-it.exec
在目标文件夹中不存在
Java 1.8. Maven 3.8. I want to generate coverage report of junit tests. So I use this in my pom.xml
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.4.201502262128</version>
<executions>
<execution>
<id>prepare-ut-agent</id>
<phase>process-test-classes</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
<propertyName>jacoco.agent.ut.arg</propertyName>
<append>true</append>
</configuration>
</execution>
<execution>
<id>prepare-it-agent</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<propertyName>jacoco.agent.it.arg</propertyName>
<append>true</append>
</configuration>
</execution>
</executions>
</plugin>
Open terminal and run test like this:
mvn test -Dtest=com.my_company.myproject.ComponentServiceTest
Tests success finish. But coverage report to generate. File jacoco-it.exec
is not exist in target folder
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pom.xml
缺少报告
目标,如@rajani-b 。这是
报告
目标的配置。以下是
jacoco-maven-plugin
的完整&lt; plugin&gt;
供参考。The
pom.xml
is missing thereport
goal as mentioned in the comment by @rajani-b.Here is the configuration for the
report
goal.Below is the complete
<plugin>
section forjacoco-maven-plugin
for reference.