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,得到结果报告。

  • 相关阅读:
    对在Qtopia中添加国际化支持一文补充
    在Redhat中添加微软雅黑字体
    QGridLayout中multi cell处理
    QScrollArea处理与显示问题
    升级ubuntu后EMACS 无法使用
    在Qtopia中添加国际化支持
    Delphi面向对象编程的20条规则
    Spring AOP 实例
    使用Dynamic LINQ实现Ext Grid的远程排序
    高效实现数据仓库的七个步骤
  • 原文地址:https://www.cnblogs.com/digod/p/12710431.html
Copyright © 2011-2022 走看看