今天打开testNG报告,发现汉字部分全是乱码。百度几番终于可以正常显示了,这里详细步骤记录一下。
信息参考处:https://www.cnblogs.com/testwjr/p/7873075.html
1. 下载插件testng-xslt-1.1.2压缩包;http://pan.baidu.com/s/1jIvgop4
2.解压文件testng-xslt-1.1.2,把
lib 文件下的saxon-8.7.jar 和 SaxonLiason.jar 拷贝到项目的lib文件夹,若没有lib,新建一个在项目目录下(参考文章写的test-output下,但是放在那里我运行会报错)
3.把
testng-results.xsl 放到项目的test-out文件夹下,该文件在解压文件目录下/src/main/resources/
4.点击自己的项目右键New-File-build.xml(创建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" >
<fileset dir= "${lib.dir}" includes= "*.jar" />
</path>
<target name= "transform" >
<xslt in= "E:\CandySelenium\auto\test-output\testng-results.xml"
style= "E:\CandySelenium\auto\test-output\testng-results.xsl"
out= "E:\CandySelenium\auto\test-output\index.html " >
<param name= "testNgXslt.outputDir" expression= "E:\CandySelenium\auto\test-output" />
<classpath refid= "test.classpath" />
</xslt>
</target>
</project>
<project name= "testTng" basedir= "." default="transform">
<property name= "lib.dir" value= "lib" />
<path id= "test.classpath" >
<fileset dir= "${lib.dir}" includes= "*.jar" />
</path>
<target name= "transform" >
<xslt in= "E:\CandySelenium\auto\test-output\testng-results.xml"
style= "E:\CandySelenium\auto\test-output\testng-results.xsl"
out= "E:\CandySelenium\auto\test-output\index.html " >
<param name= "testNgXslt.outputDir" expression= "E:\CandySelenium\auto\test-output" />
<classpath refid= "test.classpath" />
</xslt>
</target>
</project>
5. 右键项目名字->Properties->Builders->New->Ant Builder,分别选择build.xml的位置和项目的位置,保存
6. bulid.xml右键 Run as ->Ant Build
7.查看报表index.html