简体   繁体   English

如何在控制台上显示maven-surefire-plugin单元测试覆盖率报告

[英]How to show maven-surefire-plugin unit test coverage report on console

I want to show unit test coverage report in tabular format whenever someone executes mvn test on console itself. 当有人在控制台本身执行mvn test时,我想以表格格式显示单元测试覆盖率报告。 I found that maven-surefire-plugin can only produce report in XML or HTML format and even that to a directory ( target/coverage-report ). 我发现maven-surefire-plugin只能生成XML或HTML格式的报告,甚至可以生成目录( target/coverage-report )。 Is there some other plugin that can help me achieve same output? 是否有其他插件可以帮助我实现相同的输出?

Yes, you can set the useFile attribute to false : 是的,您可以将useFile属性设置为false

Option to generate a file test report or just output the test report to the console. 生成文件测试报告或仅将测试报告输出到控制台的选项。

By default, this attribute is true which means that maven-surefire-plugin will output the reports to files and not in the console. 默认情况下,此属性为true ,这意味着maven-surefire-plugin会将报告输出到文件而不是控制台。

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.19.1</version>
  <configuration>
    <useFile>false</useFile>
  </configuration>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM