用TestNG测试后,自动会生成html的测试报告,不过相信大家都有感觉,自动生成的测试报告太难看了,所以我们又用了ReportNG来美化它。在 这里给大家再介绍一下比reportNG还要稍稍美观一点的reporting tool: testNG-xslt.

官方网址: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,打开它就是测试报告了。

 转换前的测试报告:

使用TestNG-xslt美化测试报告

 转换后的测试报告(是不是美观很多呢):

 使用TestNG-xslt美化测试报告

 

参考:http://www.cnblogs.com/zhangfei/archive/2011/04/20/2022213.html

相关文章:

  • 2022-02-17
  • 2022-12-23
  • 2021-12-08
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2021-06-21
  • 2021-07-12
  • 2021-08-28
  • 2021-11-06
  • 2022-12-23
  • 2021-10-11
  • 2021-12-06
相关资源
相似解决方案