maven测试报告格式 [英] maven test report format

查看:554
本文介绍了maven测试报告格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行测试时在我的Java / Groovy Maven项目中,测试报告存储在 target / surefire-reports 中。对于每个运行的测试类,创建一个 .txt .xml 文件,以显示该类的输出。 / p>

总而言之,这是一种非常不利的格式,因为它没有提供任何简单的方法来快速查看哪些测试失败以及他们生成的输出。我想要类似于Grails的测试报告。是否有任何简单的方法可以将报告格式更改为更友好的用户界面?



理想情况下,我希望在运行<$ c $时生成此报告c> mvn test ,即我不希望运行 mvn site 来生成它。

解决方案

我使用Maven Surefire Report插件来生成单元测试报告。该网站是 http://maven.apache.org/plugins/maven-surefire -report-plugin



我的POM看起来像下面这样: - $ / b
$ b

 <报告> 
< plugins>
....
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-surefire-report-plugin< / artifactId>
< version> 2.9< / version>
< / plugin>
< / plugins>
< / reporting>

我希望这可以帮助您达到您的要求。



//编辑:我也使用CI服务器Jenkins,它也提供了单元测试报告。



问候,



Charlee Ch。


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.

解决方案

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: -

<reporting>
    <plugins>
        ....
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.9</version>
        </plugin>
    </plugins>
 </reporting>

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.

这篇关于maven测试报告格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆