优化testng报告

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

 




来源:https://www.jianshu.com/p/e6fba73b2dd2

猜你喜欢

转载自www.cnblogs.com/kaibindirver/p/12156499.html
今日推荐