使用TestNG-xslt美化测试报告
用TestNG测试后,自动会生成html的测试报告,不过相信大家都有感觉,自动生成的测试报告太难看了,所以我们又用了ReportNG来美化它。在 这里给大家再介绍一下比reportNG还要稍稍美观一点的reporting tool: testNG-xslt.
官方网址:http://code.google.com/p/testng-xslt/
用 户讨论区:http://groups.google.com/group/testng-xslt-users/topics
其 实testNG-xslt就是把testNG自动生成的测试报告testng-results.xml进行了一个转换,把它的html输出报告变得更漂亮 而已。因此用法也很简单:
1. 在官方网站上下载testNG-xslt ,http://testng-xslt.googlecode.com/files/testng-xslt-1.1.zip
2. 解压后把saxon-8.7.jar放到project的lib目录下(在bulid路径里也把这个lib加上)
3. 然后再把/src/main/resources/testng-results.xsl放到你的 test-output 目录下
4. 在测试项目的根目录下创建一个简单的build.xml, 如下:
<?xml version="1.0" encoding="UTF-8"?>
<project name= "testTng" basedir= "." default="transform">
<property name= "lib.dir" value= "lib" />
<path id= "test.classpath" >
<!-- adding the saxon jar to your classpath -->
<fileset dir= "${lib.dir}" includes= "*.jar" />
</path>
<target name= "transform" >
<xslt in= "G:/eclipse3.7/workspace/testTng/test-output/testng-results.xml" style= "G:/eclipse3.7/workspace/testTng/test-output/testng-results.xsl"
out= "G:\eclipse3.7\workspace\testTng\test-output\index1.html " >
<!-- you need to specify the directory here again -->
<param name= "testNgXslt.outputDir" expression= "G:\eclipse3.7\workspace\testTng\test-output" />
<classpath refid= "test.classpath" />
</xslt>
</target>
</project>
5.最后用 ant 运行这个 xml 就会在test-output 目录下生成 index1.html,打开它就是测试报告了。
转换前的测试报告:
转换后的测试报告(是不是美观很多呢):
参考:http://www.cnblogs.com/zhangfei/archive/2011/04/20/2022213.html
最新文章
- TypeScript Function(函数)
- python中函数接收多余参数
- ORACLE导入、导出命令使用方法
- 你真的了解UIViewController跳转吗?
- docker 1.0.0发布以及一个bug依赖apparmor_parser
- Python中使用自定义类class作为海量数据结构时内存占用巨大的问题
- [bzoj1296][SCOI2009]粉刷匠(泛化背包)
- wp8.1 Study9:针对不同的屏幕和手机方向调整UI
- Lock锁
- ADO.NET 快速入门(六):读写 XML
- Android(java)学习笔记98:关于string类型的面试题
- mongdb使用场景
- Xamarin.Android开发实践(一)
- openwrt ramips随记
- node.js 开发环境配置 和使用方式
- 使用matplotlib绘制多轴图
- Python Linear algebra
- vue.js安装过程(npm安装)
- Excel组合图表快速制作小功能
- 阿里云消息队列的C#使用http接口发送消息实例