我如何为Junit结果生成HTML报告? [英] How can I generate an HTML report for Junit results?

查看:1275
本文介绍了我如何为Junit结果生成HTML报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法(很容易)生成一个包含测试结果的HTML报告? PS:鉴于项目结构,我不应该使用Ant:(

)$($)$如果你可以使用Ant,那么你可以使用JUnitReport任务,详情如下: http://ant.apache.org/manual/Tasks/junitreport.html ,但您在您的问题是你不应该使用Ant
我相信任务只是将XML报告转换为HTML,因此使用任何XSLT处理器生成类似的报告都是可行的。



或者,您可以切换到使用TestNG( http://testng.org/doc /index.html ),它与JUnit非常相似,但有一个默认的HTML报告以及其他一些很酷的功能。


Is there a way to (easily) generate a HTML report that contains the tests results ? I am currently using JUnit in addition to Selenium for testing web apps UI.

PS: Given the project structure I am not supposed to use Ant :(

解决方案

If you could use Ant then you would just use the JUnitReport task as detailed here: http://ant.apache.org/manual/Tasks/junitreport.html, but you mentioned in your question that you're not supposed to use Ant. I believe that task merely transforms the XML report into HTML so it would be feasible to use any XSLT processor to generate a similar report.

Alternatively, you could switch to using TestNG ( http://testng.org/doc/index.html ) which is very similar to JUnit but has a default HTML report as well as several other cool features.

这篇关于我如何为Junit结果生成HTML报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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