美文网首页Java日常学习
优化testNG中的测试报告

优化testNG中的测试报告

作者: LeslieFind | 来源:发表于2019-01-15 22:47 被阅读0次

    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

    相关文章

      网友评论

        本文标题:优化testNG中的测试报告

        本文链接:https://www.haomeiwen.com/subject/enwudqtx.html