maven工程
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jacoco.tutorial</groupId>
<artifactId>jacoco-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>

本文介绍了如何在maven工程中结合jacoco进行Java代码的测试覆盖率检查。通过配置pom.xml文件,可以运行测试并生成覆盖率报告,报告默认位于 argetsitejacocoindex.html。此外,还提到了通过mvn test surefire-report:report命令生成测试用例报告,并且链接了一个更详细的教程,讨论了jacoco的实时插桩和离线插桩模式。
最低0.47元/天 解锁文章
6203

被折叠的 条评论
为什么被折叠?



