TestNG之使用ReportNG生成测试报告


TestNG使用ReportNG生成测试报告会更加美观。

  • 依赖包
 1  <!--testNG报告依赖包-->
 2         <dependency>
 3             <groupId>org.testng</groupId>
 4             <artifactId>testng</artifactId>
 5             <version>6.14.3</version>
 6             <scope>test</scope>
 7         </dependency>
 8         <dependency>
 9             <groupId>org.uncommons</groupId>
10             <artifactId>reportng</artifactId>
11             <version>1.1.4</version>
12             <scope>test</scope>
13         </dependency>
14         <dependency>
15             <groupId>com.google.inject</groupId>
16             <artifactId>guice</artifactId>
17             <version>4.2.2</version>
18         </dependency>

 

  • 构建配置

监听名:org.uncommons.reportng.HTMLReporter

 

  • TestNG.xml配置
<suite>

     ...

   <listeners>
        <!--testng的XML配置文件中添加这些内容-->
        <listener class-name="org.uncommons.reportng.HTMLReporter"/>
        <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
    </listeners>

</suite>

 

  • 报告样式举例

./test-output/html/index.html

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM