打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Eclipse本地使用reportng查看testng运行结果

ReportNG is asimple HTML reporting plug-in for the TestNG unit-testing framework. It isintended as a replacement for the default TestNG HTML report. The defaultreport is comprehensive but is not so easy to understand at-a-glance. ReportNGprovides a simple, colour-coded view of the test results.

reportng 是一个简单的testng的生成html格式报告插件,是为了取代testng默认的html report.tesng默认的report不容易理解,也不太美观。reportng提高简单的,多彩的测试结果的视图.

那么问题就来了,怎么使用?

1.首先安装testng plug-in

      详情参考官网:http://testng.org/doc/download.html

2.reportng jarguice jar的配置

    注意:是在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>3.0</version>

                        <scope>test</scope>

                </dependency>

                <dependency>

<groupId>org.testng</groupId>

<artifactId>testng</artifactId>

<version>6.9.10</version>

</dependency>

<dependency>

<groupId>velocity</groupId>

<artifactId>velocity</artifactId>

<version>1.4</version>

</dependency>

   保存后,自动开始下载资源包。

 

3.查看maven仓库

   Maven Dependencies jar是否下载成功。

 

4.eclipse配置reportng

 禁用testng default listeners

define listener中添加:org.uncommons.reportng.HTMLReporter

最后run as test suite

在test-output>html目录就能看到漂亮的report

如果在ant里使用,需要这样

    <testng classpathref="runpath"  outputDir="test-output"

            haltonfailure="true"

            useDefaultListeners="false"  

            listeners="org.uncommons.reportng.HTMLReporter,org.testng.reporters.FailedReporter" > 

            <xmlfilesetdir="${basedir}" includes="Parametertestng.xml"/>

            <jvmargvalue="-Dfile.encoding=UTF-8" />

            <syspropertykey="org.uncommons.reportng.title" value="AutoMationTestReport" />

        </testng>


Tips:以上做法方便在本地调试时使用。当你直接拿着@Test类来运行测试用例,eclipse会自动启动默认local的testng-customsuite.xml配置文件,该文件目录一般在(如图):

C:\Users\xx\AppData\Local\Temp\testng-eclipse-1200547509\testng-customsuite.xml

 
 

通过上述配置后,查看test-output文件下index.html会显示出来Reportng-Result。

但是,当你需要使用服务器来跑tesng.xml文件时,使用reportng做报告输出;那就需要通过解

析你目录下写的testng.xml和另外的配置了

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
TesterHome | SVN+Jenkins+Maven+Appium+TestNG+ReportNG 实战 Android 自动化测试 ? 社区
myBatis系列之一:搭建开发环境
Maven管理依赖
初学maven(2)-maven/artifactory/m2eclipse安装全过程 - dream in the java world - BlogJava
Maven单元测试
使用ReportNG为TestNG提供更好的测试报告
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服