testNG之测试报告
上一篇 /
下一篇 2018-11-06 11:44:19
/ 个人分类:白盒测试工具
执行完测试用例之后,会在项目的test-output(默认目录)下生成测试报告 打开index.html文件,测试结果摘要,包括:套件名、测试用例成功数、测试用例失败数、测试用例忽略数和testng.xml文件 测试用例都成功的话,测试结果以绿底标志:
测试用例有失败的话,测试结果以红底标志:
点击"Link"链接,可以查看testng.xml文件的内容:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"><suiteverbose="0"name="Suite1"parallel="false"><testname="testNG1"preserve-order="false"><classes><classname="testNG1"/><classname="testNG2"/><classname="testNG3"/></classes></test></suite> |
点击"Suite1"链接,可以查看更详细的信息:
点击"Results"链接,可以查看详细的测试结果:
testng-xslt
testNG自带生成的测试报告不太美观,可以使用testng-xslt进行美化:
现在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文件,内容如下:
<projectname="testNG"basedir="."><propertyname="lib.dir"value="lib"/><pathid="test.classpath"><!--adding the saxon jar to your classpath--><filesetdir="${lib.dir}"includes="*.jar"/></path><targetname="transform"><!--需要根据自己的环境进行配置(将E:/workspace/testNG/替换成你自己project的目录)--><xsltin="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的目录)--><paramname="testNgXslt.outputDir"expression="E:/workspace/testNG/test-output/"/><classpathrefid="test.classpath"/></xslt></target></project> |
7、在cmd里,切换到project的目录,执行anttransform: 8、到配置的路径下,打开生成的文件index1.html,以图形化的界面展示测试结果:
信息都差不多,只是页面优化,更加美观了
相关阅读:
- testNG报告优化,testNG-xslt (旺达, 2018-10-19)
- TestNG套件测试 (旺达, 2018-10-22)
- TestNG数据驱动的袖里乾坤 (旺达, 2018-10-23)
- testng生成自定义html报告 (旺达, 2018-10-24)
- TestNG使用DataProvider+Excel实现DDT (旺达, 2018-10-25)
- Idea+TestNg配置test-output输出 (旺达, 2018-10-26)
- 当我们谈隐私安全时,我们在谈些什么 (旺达, 2018-10-29)
- TestNG关键字dependsOnMethods踩坑记 (旺达, 2018-11-01)
- testng 异常 截图 (旺达, 2018-11-02)
- TestNg 2.套件测试 (旺达, 2018-11-05)
收藏
举报
TAG:
TestNG
testNG
安全测试