用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

最新文章

  1. TypeScript Function(函数)
  2. python中函数接收多余参数
  3. ORACLE导入、导出命令使用方法
  4. 你真的了解UIViewController跳转吗?
  5. docker 1.0.0发布以及一个bug依赖apparmor_parser
  6. Python中使用自定义类class作为海量数据结构时内存占用巨大的问题
  7. [bzoj1296][SCOI2009]粉刷匠(泛化背包)
  8. wp8.1 Study9:针对不同的屏幕和手机方向调整UI
  9. Lock锁
  10. ADO.NET 快速入门(六):读写 XML
  11. Android(java)学习笔记98:关于string类型的面试题
  12. mongdb使用场景
  13. Xamarin.Android开发实践(一)
  14. openwrt ramips随记
  15. node.js 开发环境配置 和使用方式
  16. 使用matplotlib绘制多轴图
  17. Python Linear algebra
  18. vue.js安装过程(npm安装)
  19. Excel组合图表快速制作小功能
  20. 阿里云消息队列的C#使用http接口发送消息实例

热门文章

  1. Linux--add the PPA to your system
  2. ROS学习笔记INF-重要操作列表
  3. 关于Java构造类与对象的思考
  4. ORACLE锁表问题
  5. 仿有道词典App开发
  6. Linux开机流程及运行级别
  7. 「USACO5.4」奶牛的电信Telecowmunication
  8. 尝试使用 Visual Studio Online (Cloud IDE)
  9. Nginx反向代理实现负载均衡配置图解
  10. springboot的maven多模块项目架构微服务搭建——构建多模块项目(依赖方式)