zoukankan      html  css  js  c++  java
  • 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,得到结果报告。

  • 相关阅读:
    delete、truncate、drop的区别
    Java闭包
    visio 画网格图
    GPU服务器中了木马病毒
    visio 同时标注上下标
    自动缩放字体
    latex 图片
    多GPU训练
    texstudio 外部查看器错误
    Linux lsof命令详解
  • 原文地址:https://www.cnblogs.com/xbxblog/p/9883701.html
Copyright © 2011-2022 走看看