每当有人在控制台本身上执行 mvn test
时,我想以表格格式显示单元测试覆盖率报告。我发现 maven-surefire-plugin
只能生成 XML 或 HTML 格式的报告,甚至可以生成目录 (target/coverage-report
)。有没有其他插件可以帮助我实现相同的输出?
最佳答案
是的,您可以设置 useFile
属性为 false
:
Option to generate a file test report or just output the test report to the console.
默认情况下,此属性为 true
,这意味着 maven-surefire-plugin
会将报告输出到文件而不是控制台。
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<useFile>false</useFile>
</configuration>
</plugin>
关于java - 如何在控制台上显示 maven-surefire-plugin 单元测试覆盖率报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35435657/