testng中使用reportng报告

1、pom.xml文件中添加依赖,重构一下项目(mvn compile)

<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>

2、在testng.xml中的suite下添加监听
<listeners >
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>

3、运行testng.xml,可以看到生成了test-output目录

4、打开index.html,可以看到界面比较清晰友好的测试报告

 

 


原文地址:https://www.cnblogs.com/kusy/p/8874059.html