testNG测试报告美化



testng-xslt

testNG自带生成的测试报告不太美观,可以使用testng-xslt进行美化:

1、下载testng-xslt包,http://testng-xslt.googlecode.com/files/testng-xslt-1.1.zip

   现在google可能访问不了,可到我的网盘里下载http://pan.baidu.com/s/1bn4hR9H

2、复制testng-results.xsl(testng-xslt-1.1\src\main\resources)文件到test-output目录下

3、复制saxon-8.7.jar(testng-xslt-1.1\lib)文件到project的lib目录下(没有的话,自己新建)

4、安装ant,http://mirror.bit.edu.cn/apache/ant/binaries/apache-ant-1.9.4-bin.zip

5、配置好环境变量PATH

6、在project目录下,新建build.xml文件,内容如下:

<project name="testNG" basedir="." >
    <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" >
        <!-- 需要根据自己的环境进行配置(将E:/workspace/testNG/替换成你自己project的目录) -->
        <xslt in="E:/workspace/testNG/test-output/testng-results.xml" style="E:/workspace/testNG/test-output/testng-results.xsl"
  out="E:/workspace/testNG/test-output/index1.html" >
             <!-- 需要根据自己的环境进行配置(将E:/workspace/testNG/替换成你自己project的目录) -->
            <param name="testNgXslt.outputDir" expression="E:/workspace/testNG/test-output/" />
            <classpath refid="test.classpath" />
        </xslt>
    </target>
</project> 
 
 
 
 
7、在cmd里,切换到project的目录,执行ant transform:
8、到配置的路径下,打开生成的文件index1.html,以图形化的界面展示测试结果:
 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值