reportng报告

reportng报告

mvn依赖包:

	<dependency>
        <groupId>org.uncommons</groupId>
        <artifactId>reportng</artifactId>
        <version>1.1.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.0</version>
        <scope>test</scope>
    </dependency>

pom.xml中增加插件

<build>
        <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>xmlfile/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <properties>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>listener</name>
                            <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
                        </property>
                    </properties>
                    <workingDirectory>target/</workingDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

在testng.xml中配置监听器

<?xml version="1.0" encoding="UTF-8"?>
<!--测试套件-->
<suite name="Suite" parallel="false"><!--parallel是不是支持并发测试-->
  <!--测试集-->
  <test name="Test1"> <!--测试的名称-->
  <!--测试类集合-->
    <classes>
      <!--对应的每个测试类-->
      <class name="ApiTest.ApiTestng"/>
    </classes>
  </test> <!-- Test -->
        <listeners>
                   <listener class-name="org.uncommons.reportng.HTMLReporter" />
                   <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
      </listeners>
</suite>

运行后在 est-outputhtml点击index.html,得到结果报告。也可通过修改路径

作者:我是刘先生
地址:https://www.cnblogs.com/cekaigongchengshi/
文章转载请标明出处,如果,您认为阅读这篇博客让您有些收获,不妨点击一下推荐按钮,据说喜欢分享的,后来都成了大神

欢迎扫码关注微信公众号
原文地址:https://www.cnblogs.com/cekaigongchengshi/p/13724857.html