zoukankan      html  css  js  c++  java
  • Reportng配置

    转自:https://www.cnblogs.com/xbxblog/p/9883701.html

    reportng在maven中的配置

    reportng是替代testng报告的一个报告插件,优势在于美观。不过1.1.4版本是reportng的最后一个版本,已经不再更新了。

    对比下两者的不同,下面是testng自带的报告,打开就很慢:

    下面是reportng的报告,看着是不是更容易接收?

    在maven项目中配置reportng,需要做几处修改:

    (1)pom.xml 添加依赖

    复制代码
        <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>        
    复制代码

    然后,添加插件

    复制代码
    <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>
    复制代码

    (2)testng.xml中配置listener:

         <listeners>
        
            <listener class-name="org.uncommons.reportng.HTMLReporter" />
                    <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
        </listeners>

    配置完成后,运行testng,在 est-outputhtml点击index.html,得到结果报告。

  • 相关阅读:
    Android控件之圆形Button
    MotionEvent常见值
    Android通过URL加载网络图片
    Android音频播放实例
    Android沉浸式任务栏的实现
    Android学习之路书籍推荐
    Linux端BaiduPCS-Go使用方法
    Remove Duplicates from Sorted ListII
    RemoveDuplicatesfromSortedList
    Partition List 划分链表
  • 原文地址:https://www.cnblogs.com/digod/p/12710431.html
Copyright © 2011-2022 走看看