使用testng-xslt优化测试报告
1、下载testng-xslt,https://pan.baidu.com/s/19a18CgJVbuRbu6Ud6BfYQw,提取码xmu3 2、在工程下创建lib文件夹,将testng-xslt-1.1.2\testng-xslt-1.1.2\lib下的jar包放如新建的lib目录下 3.将testng-xslt-1.1.2\testng-xslt-1.1.2\src\main\resources的testng-results.xsl放入testng-output目录下
4.在工程下新建new->file->build.xml,内容如下: name:tcp32960 工程名称 in:testng输出的结果文件路径 out:xslt输出的路径 Expression:输出路径
<?xml version="1.0" encoding="UTF-8"?>
<project name= "tcp32960" 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= "F:/workspace1/tcp32960/test-output/testng-results.xml" style= "F:/workspace1/tcp32960/test-output/testng-results.xsl"
out= "F:/workspace1/tcp32960/test-output/index1.html" >
<!-- you need to specify the directory here again -->
<param name= "testNgXslt.outputDir" expression= "F:/workspace1/tcp32960/test-output" />
<classpath refid= "test.classpath" />
</xslt>
</target>
</project>
5.选择build.xml,点击右键,运行“ant” 6.查看输出的文件index1.xml,如下,是不是好看多了:
|