我对 maven scoverage 插件很陌生,它是与我合作的团队中首选的代码覆盖工具。 我正在尝试使用以下命令生成测试覆盖率报告:
read(1001,*) (m(i,j), j=1, 3)
它给了我一份详细的报告,显示了代码行和分支方面的类名和代码覆盖率,但没有显示单元测试未覆盖哪些代码行/分支。
是否有可用于显示这些行或作为报告的一部分生成的 scoverage 选项?
我尝试过谷歌搜索,但没有找到任何对搜索有帮助的内容
答案 0 :(得分:0)
所以最后我想通了,我需要做的就是在插件部分做一个小改动以覆盖我的 pom 文件并将突出显示设置为 true
之前:
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<minimumCoverage>80</minimumCoverage>
<failOnMinimumCoverage>true</failOnMinimumCoverage>
<aggregate>true</aggregate>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal> <!-- or integration-check -->
</goals>
<phase>prepare-package</phase> <!-- or any other phase -->
</execution>
</executions>
</plugin>
之后:
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<highlighting>true</highlighting>
<minimumCoverage>80</minimumCoverage>
<failOnMinimumCoverage>true</failOnMinimumCoverage>
<aggregate>true</aggregate>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal> <!-- or integration-check -->
</goals>
<phase>prepare-package</phase> <!-- or any other phase -->
</execution>
</executions>
</plugin>