testng系列-ReportNG
生成reportng报告操作步骤:
一、maven的pom.xml文件需要添加内容:
<properties>
<!-- maven 参数配置,这里引用不同的testng.xml -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<xmlFileName>testng.xml</xmlFileName>
</properties>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<!-- <scope>compile</scope> -->
<scope>test</scope>
</dependency>
<!-- 依赖reportNg 关联testNg-->
<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>
<!-- 依赖Guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<!-- build -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<systemPropertyVariables>
<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
<suiteXmlFiles>
<suiteXmlFile>res/${xmlFileName}</suiteXmlFile>
<!--表示使用xmlFileName作为testNG的配置文件 -->
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
<!--当case错误的时候继续运行,否则当case错误的时候报build错误 -->
</configuration>
</plugin>
<!-- 添加插件,添加ReportNg的监听器,修改最后的TestNg的报告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</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>
<forkMode>always</forkMode>
</configuration>
</plugin>
</plugins>
</build>
备注:以上内容添加完成后运行Maven install确保依赖包加载到工程的Maven Dependencies里边;
二、testng的testng.xml文件需要添加内容:
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
三、选中pom.xml执行Maven test后测试报告艘在位置及最终效果如下:
1)位置

2)效果


testng系列-ReportNG的更多相关文章
- Idea+maven+testNG+Selenium+ReportNG自动化框架搭建
1.Idea创建一个空的Maven项目 创建后默认项目目录如图所示 2.配置pom.xml文件 <?xml version="1.0" encoding="UTF- ...
- 自动化测试:java + testng + maven + reportng + jenkins + selenium (一)_基于win环境
集成环境:jdk1.7 + tomcat1.7+ eclipse mars + maven + testng6.14.2 + selenium-java2.40.0 + reportng1.1.4 + ...
- 我的自动化测试历程(Selenium+TestNG+Java+ReportNG+Jenkins)
原地址:http://blog.csdn.net/shilinjie_8952/article/details/53380373?locationNum=11&fps=1 测试环境:Java+ ...
- IDEA+MAVEN+testNG(reportNG)
转载:http://www.cnblogs.com/aikachin/p/7765846.html 参考: http://blog.csdn.net/langsand/article/details/ ...
- Selenium 我的自动化测试历程 (Selenium+TestNG+Java+ReportNG+Jenkins)
测试环境:Java+Selenium+TestNG,Jenkins持续集成. 测试代码 代码结构 采用页面对象模型(Page Object),减少UI修改后,对代码的影响. Java编写,采用Te ...
- TestNG系列(五)TestNG测试报告
以TestNG执行测试方法后会生成test-output测试结果集,其中index.html是测试结果的展示.TestNG的测试报告可以通过IReporter监听自定义,也可以通过第三方工具(Repo ...
- TestNG系列之四: TestNg依赖 dependsOnMethods
有时候,你可能需要在一个特定的顺序调用方法 执行原则: 1.被依赖的先执行: 2. 再执行没配置依赖的, 3.再执行需要依赖的: 4.若无依赖关系,依次执行) 一个方法有多个依赖时用空格隔开 有两种依 ...
- TestNG系列之二:TestNG套件测试
测试套件的测试是为了测试软件程序的行为或一系列行为的情况下,是一个集合.在TestNG,我们不能定义一套测试源代码,但它代表的套件是一个XML文件执行特征.这也允许灵活的配置要运行的测试.套件可以包含 ...
- TestNG系列之:TestNG基本注解(注释)
注解 描述 @BeforeSuite 注解的方法只运行一次,在当前suite所有测试执行之前执行 @AfterSuite 注解的方法只运行一次,在当前suite所有测试执行之后执行 @BeforeCl ...
随机推荐
- DDL-数据类型
一.数值型1.整型tinyint.smallint.mediumint.int/integer.bigint1 2 3 4 8 特 ...
- c#一些处理解决方案(组件,库)
1.关系数据库 postgresql,mysql,oracle,sqlserver 2.本地数据库 sqlite,berkeleydb,litedb 3.缓存数据库 redis,mongdb 4.数据 ...
- C++程序设计入门(上) string类的基本用法
string类中的函数 1. 构造 2. 追加 3. 赋值 4. 位置与清除 5. 长度与容量 6. 比较 7. 子串 8. 搜索 9. 运算符 追加字符串 string s1("Welc ...
- ABAP术语-V2 Module
V2 Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115720.html Analogously to V1 the ...
- Bulk Rename Utility 3.0 + x64 中文汉化版
Bulk Rename Utility 3.0 + x64 中文汉化版由大眼仔旭(www.dayanzai.me)汉化发布.当发现做一件事情,原本用工具或软件进行批量处理也能达到相同效果,可却花了数倍 ...
- MongoDB基础教程
MongoDB 一.下载MongoDB数据库 1.进入MongoDB官网进行下载,网址:https://www.mongodb.com/. 2.下载完成后可进行安装,安装后,并有了MongoDB服务. ...
- Rabbitmq(三)
1.在服务器安装好rabbitmq后,自己配置自己用的vhost,exchange和queue的绑定 2.项目添加RabbitMqClient.dll(nuget获取)引用 3.添加helper就可以 ...
- PhpStorm 全局查找的快捷键
本页面查找 : ctrl + f 全局查找 : ctrl + shift + f 自己定义 :文件 -> 设置 -> 快捷键 -> 修改
- Nginx部署tomcat/wildfly集群负载均衡
1.调度器配置: docker run -p 80:80 --name nginx --restart=always -v /root/nginx/www/:/usr/share/nginx/htm ...
- python2.7入门---GUI编程(Tkinter)
Python 提供了多个图形开发界面的库,几个常用 Python GUI 库如下: Tkinter: Tkinter 模块(Tk 接口)是 Python 的标准 Tk GUI 工具包的接口 . ...