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