TestNG自带的测试报告不是很好用,所以一般结合reportng生成美观的测试报告。

首先,在pom.xml中添加testng和reportng相关依赖

    <dependencies>
<!-- 添加testNG依赖 -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<!-- 添加reportNG依赖 -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<scope>test</scope>
<!-- 排除testNG依赖 -->
<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>
</dependencies>

pom.xml中配置maven-surefire-plugin并加入reportng listener

    <properties>
<xmlFileName>testng.xml</xmlFileName>
</properties> <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
<suiteXmlFiles>
<suiteXmlFile>${xmlFileName}</suiteXmlFile>
</suiteXmlFiles>
<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>
<forkMode>always</forkMode>
</configuration>
</plugin>
</plugins>
</build>

在testng.xml中<suite>标签加入listener

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

在Idea中打开Run-Edit Configurations...

在Listeners标签下勾选“Use default reporters”

最后运行testng.xml,自动生成test-output目录,在html目录下找到index.html

打开index.html

Idea+maven+testng+reportng生成测试报告的更多相关文章

  1. Mac Eclipse+Maven+TestNg+ReportNg 生成测试报告

    TestNG 是java 的单元测试框架,功能很强大,很方便,但是自动生成的测试报告有待改善,可以使用TestNg 自带的TestNG_xslt更改TestNG报告的样式,这里主要讲解ReportNg ...

  2. Eclipse+Maven+TestNg+ReportNg 生成测试报告

    http://blog.csdn.net/a542551042/article/details/46729585

  3. TestNG之使用ReportNG生成测试报告

    TestNG使用ReportNG生成测试报告会更加美观. 依赖包 <!--testNG报告依赖包--> <dependency> <groupId>org.test ...

  4. Appium+Maven+TestNG(ReportNG)环境搭建(详细过程)

    最近群里经常有人会问到关于maven构建Appium测试项目以及使用testNG生成测试报告的问题,试着搭建了一下,下面是过程: jdk安装过程我这里就不说了 一.下载eclipse,推荐下载Ecli ...

  5. Maven+TestNG+ReportNG/Allure接口自动化测试框架初探(上)

    转载:http://www.51testing.com/html/58/n-3721258.html 由于一直忙于功能和性能测试,接口自动化测试框架改造的工作被耽搁了好久.近期闲暇一些,可以来做点有意 ...

  6. CentOS下搭建自动化测试基础框架:Jenkins+Maven+TestNG+ReportNG

    1. 安装JDK 1.1 卸载系统默认已安装的open-jdk rpm -qa|grep java 查出来openjdk相关的应用,把查出来的所有都要通过下面的命令给卸载掉 rpm -e --node ...

  7. maven+testng+reportng的pom设置

    在pom.xml 加入: <dependency> <groupId>org.testng</groupId> <artifactId>testng&l ...

  8. TestNG+ReportNG+Maven优化测试报告

    转载:https://www.cnblogs.com/hardy-test/p/5354733.html 首先在eclipse里面创建一个maven项目,具体要配置maven环境,请自行百度搭配环境. ...

  9. testng生成报告ReportNG美化测试报告

    testng生成报告ReportNG美化测试报告 testng生成报告ReportNG美化测试报告 ReportNG 是一个配合TestNG运行case后自动帮你在test-output文件内生成一个 ...

随机推荐

  1. Chapter 4 Syntax Analysis

    Chapter 4 Syntax Analysis This chapter is devoted to parsing methods that are typically used in comp ...

  2. OPENCL 错误码

    #define CL_SUCCESS 0 #define CL_DEVICE_NOT_FOUND -1 #define CL_DEVICE_NOT_AVAILABLE -2 #define CL_CO ...

  3. Java应用程序中的声音播放

    声音可以创造意境,触发遐想,当与虚拟图像相结合时,更加可以让整个世界充满幻觉,声音是多媒体技术的基础. 播放声音是Java对多媒体的支持一个重要部分,它支持的声音文件类型主要有: AU - (扩展名为 ...

  4. bzoj 1715: [Usaco2006 Dec]Wormholes 虫洞【spfa判负环】

    tag是假的,用了及其诡异的方法判负环 正权无向边和负权有向边的图 #include<iostream> #include<cstdio> #include<cstrin ...

  5. robotframework - 框架做接口自动化get请求

    1.做get请求之前先安装 Request库,参考github上链接 :https://github.com/bulkan/robotframework-requests/#readme 2.请求&a ...

  6. vbnet 进程监控,监控Acad开启的数量,并且添加到开机启动

    1# 自定义函数,添加到注册表 Public Sub StartRunRegHKLM() REM HKEY_LOCAL_MACHINE \ SOFTWARE \ WOW6432Node \ Micro ...

  7. HTML 5语义元素

  8. C# 的占位符

    static void Main(string[] args) { Console.WriteLine("A:{0},a:{1}",65,97); Console.ReadLine ...

  9. 转 MySQL实验(三) 过程式数据库对象的使用

    转 http://blog.csdn.net/anne999/article/details/70432558

  10. C# 生成 bmp 格式的图片

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; usin ...