maven 基于 cobertura-maven-plugin 插件提供单元测试报告

Just_Esme

关注

阅读 143

2022-10-24


1. 引入maven依赖

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</build>

2. 执行命令  

mvn cobertura:cobertura

3. 查看测试报告

报告路径 

target/site/cobertura/index.html

效果图:

maven 基于 cobertura-maven-plugin 插件提供单元测试报告_java

4. 名词解释

Line Coverage

The percent of lines executed by this test run.

Branch Coverage

The percent of branches executed by this test run.

Complexity

Average McCabe's cyclomatic code complexity for all methods. This is basically a count of the number of different code paths in a method (incremented by 1 for each if statement, while loop, etc.)

N/A

Line coverage and branch coverage will appear as "Not Applicable" when Cobertura can not find line number information in the .class file. This happens for stub and skeleton classes, interfaces, or when the class was not compiled with "debug=true."

精彩评论(0)

0 0 举报