maven测试报告格式
当我在 Java/Groovy Maven 项目中运行测试时,测试报告存储在 target/surefire-reports
中。对于运行的每个测试类,都会创建一个 .txt
和 .xml
文件,显示该类的输出。
总而言之,这是一种非常无用的格式,因为它没有提供任何简单的方法来快速查看哪些测试失败以及它们产生的输出。我想要一些类似于 Grails 测试报告的东西。有没有什么简单的方法可以将报告格式更改为更用户友好的格式?
理想情况下,我希望在运行 mvn test
时生成此报告,即我不希望必须运行 mvn site
来生成它。
When I run the tests In my Java/Groovy Maven project, the test reports are stored in target/surefire-reports
. For each test class that is run a .txt
and .xml
file is created showing the output of that class.
All in all, this is a remarkably unhelpful format, as it doesn't provide any easy way to quickly see which tests failed and the output they produced. I'd like something similar to Grails' test reports. Is there are any easy way to change the report format to something more user friendly?
Ideally, I'd like this report to be generated when I run mvn test
, i.e. I'd prefer not to have to run mvn site
to generate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用 Maven Surefire Report 插件来生成单元测试报告。该网站是 http://maven.apache.org/plugins/maven-surefire -report-plugin
我的 POM 如下所示: -
我希望这可以帮助实现您的要求。
//编辑:我还使用 CI 服务器 Jenkins,它也提供单元测试报告。
问候,
查理 Ch.
I am using the Maven Surefire Report plugin to generating the unit testing report. The web site is http://maven.apache.org/plugins/maven-surefire-report-plugin
My POM looks like the following: -
I hope this may help to achieve your requirement.
//Edit: I also use the CI server, the Jenkins, which provides the unit testing report as well.
Regards,
Charlee Ch.
按大小升序对文件夹进行排序。最大的
.txt
文件是失败测试的输出。Sort the folder by size in ascending order. Biggest
.txt
files are the output of failed tests.有一个 HTML 报告插件(此处),但不确定这一点就是你想要的。如果您需要更具体的东西,我想您需要开发自己的 Maven 插件。
There is an HTML report plugin (here), but not sure this is what you want. If you need something more specific, I guess you'll need to develop your own Maven plugin.