优化testNG中的测试报告
2019-01-15 本文已影响0人
LeslieFind
1、在maven中的pom.xml中添加dependency
<!-- reportng替代testng报告 -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
2、在tesgng.xml中添加listeners标签
<?xml version="1.0" encoding="UTF-8"?>
<suite name="自测demo" parallel="false">
<parameter name="filePath" value="d:\\app_testcase.xlsx"/>
<parameter name="filePath2" value="d:\\test01.xlsx"/>
<test name="接口自动化">
<listeners>
<listener class-name = "org.uncommons.reportng.HTMLReporter"/>
<listener class-name = "org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
<classes>
<class name="com.api.run.TestRun"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
3、查看测试报告在test-output--->html---->index.html
image.png