maven test report format

谁都会走 提交于 2019-12-10 15:06:21

问题


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.


回答1:


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.




回答2:


Sort the folder by size in ascending order. Biggest .txt files are the output of failed tests.




回答3:


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.



来源:https://stackoverflow.com/questions/6503895/maven-test-report-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!