关于reportng的官网介绍:http://reportng.uncommons.org/

1.下载reportNG的jar包:http://pan.baidu.com/s/1hq5znLU

2.reprotNG的源码:https://github.com/dwdyer/reportng

3.在项目中导入reportNG的jar包

4.更改eclipse设置

5.设置完成后,运行项目,在项目test-output/html/index.html即可查看report

6.设置reportng的编码

更改源文件的AbstractReporter.java,并替换相应jar包的class

    protected void generateFile(File file,
String templateName,
VelocityContext context) throws Exception
{
//Writer writer = new BufferedWriter(new FileWriter(file));
//encoding to utf-8
OutputStream out=new FileOutputStream(file);
Writer writer=new BufferedWriter(new OutputStreamWriter(out,"utf-8"));
try
{
Velocity.mergeTemplate(classpathPrefix + templateName,
ENCODING,
context,
writer);
writer.flush();
}
finally
{
writer.close();
}
}

7.更改报告的方法排列顺序,按照方法的执行先后顺序来进行排序的

更改TestResultComparator.java,并替换相应jar包的class

     public int compare(ITestResult result1, ITestResult result2)
{
//return result1.getName().compareTo(result2.getName());
int longresult2 = 0;
if(result1.getStartMillis()<result2.getStartMillis()) {
longresult2 = -1;
}else {
longresult2 = 1;
}
return longresult2;
}

8.teng的xml文件

<?xml version="1.0" encoding="UTF-8"?>
<suite name="测试用例集" parallel="false">
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
<test verbose="8" name="TestNgrepotng">
<classes>
<class name="com.reprot.TestNgrepotng"/>
</classes>
</test> <!-- Test -->
<test verbose="8" name="Test22">
<classes>
<class name="com.reprot.Test22"/>
</classes>
</test>
</suite> <!-- Suite -->

9.更改报告输出样式

在reportng-1.1.4.jar的reportng.properties文件中增加

oneclass.description=Description
oneclass.duration=Duration
oneclass.testdata=Data being used
oneclass.testresult=Test result
oneclass.screenshot=Screen shot
oneclass.additionalinfo=Additional Info

在reportng-1.1.4.jar的results.html.vm文件中更改

<tr>
<td colspan="1" class="group">$testClass.name</td>
<td colspan="1" class="group">$messages.getString("oneclass.duration")</td>
<td colspan="1" class="group">$messages.getString("oneclass.testresult")</td>
</tr>

10.效果图

使用reportNG替换testNG的默认报告的更多相关文章

  1. reportng代替testng的默认报告——pom设置

    既然是maven项目,直接关注pom设置. 这篇写得很清楚了:maven+testng+reportng的pom设置 强调一点的是,guice必须依赖,就因这个卡了大半天. <dependenc ...

  2. [唐胡璐]Selenium技巧- ReportNG替换TestNG默认结果报告

    TestNG默认的报告虽然内容挺全,但是展现效果却不太理想,不易阅读。因此我们想利用ReportNG来替代TestNG默认的report。 什么是ReportNG呢?这里不多说,请直接参见:http: ...

  3. ReportNG 替换testng过程中遇到的问题

    1. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collectio ...

  4. ReportNG 替换testng获得测试报告

    1.导入reportng相关jar包

  5. Maven与Ant使用reportNG代替testng

    大家在使用TestNG时一定会发现其本身的报告生成不但简陋而且相当的不美观,而ReportNG正是一款为TestNG量身定做的报告生成插件,其报告美观.简约.清晰.漂亮的特点让很多TestNG开始慢慢 ...

  6. UI自动化测试篇 :ReportNG替代TestNG自带html版测试报告初探

    转载http://www.cnblogs.com/chengtch/p/6071322.html “1.1.4版本的ReportNG是最后一个版本,之后不再做维护.作为一个简单的测试报告插件,它是创造 ...

  7. Jenkins进阶系列之——01使用email-ext替换Jenkins的默认邮件通知

    1 简述 众所周知,Jenkins默认提供了一个邮件通知,能在构建失败.构建不稳定等状态后发送邮件.但是它本身有很多局限性,比如它的邮件通知无法提供详细的邮件内容.无法定义发送邮件的格式.无法定义灵活 ...

  8. Configuration ReportNG with TestNG

    下载 Reporter.jar,velocity-dep-1.4.jar 和 Guice.jar: 配置项目属性:Properties ->TestNG ->Disable Default ...

  9. 替换Gravatar头像默认服务器

    这几天Gravatar头像服务器应该集体被墙了,头像无法显示.兵来将挡,水来土掩,上有政策,下有对策,和谐社会靠大家,哈. 利用多说Gravatar头像中转服务器替代头像默认服务器. 将下面代码添加到 ...

随机推荐

  1. csharp: Sound recording

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsof ...

  2. Win7配置Go环境

    最近想学习下Go语言,先从最基本的Hello Go开始,搭建Go开发环境 一.下载Go包 由于Go官网国内访问经常有问题,可以从国内的镜像下载: http://www.golangtc.com/ 二. ...

  3. cURL和HTTPie

    http://lingxiankong.github.io/blog/2014/08/19/curl-httpie/ 前两天在网上看到一个号称比cURL更牛逼的命令行工具HTTPie,提供命令行交互方 ...

  4. LGLSearchBar

    平时我们都是用UITextFeild 来写搜索框, 最近有时间就自己重新封装了UISearchBar, 他可以自行修改里面的属性来达到我们使用的要求. 源代码下载地址:https://github.c ...

  5. Python 学习笔记1

    1.Python2.x与3​​.x版本区别 2.常量与变量 3.if  elif  else 4.注释 5.用户交互 6.字符串拼接 7.文件扩展名 8.缩进 9.运算符 10.while循环 Pyt ...

  6. ValueStack值栈和ActionContext

    Struts2在OGNL之上提供的最大附加特性就是支持值栈(ValueStack),在OGNL上下文中只能有一个根对象,Struts2的值栈则允许存在许多虚拟对象. 一:值栈(ValueStack) ...

  7. Python语言规范及风格规范

    语言规范: http://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_ ...

  8. C# 分层 三层架构

    Hello! 三层架构↓↓↓↓↓↓ 三层架构分为:表现层(UI(User Interface)).业务逻辑层(BLL(Business Logic Layer)).数据访问层(DAL(Data Acc ...

  9. Ansible用于网络设备管理 part 1 Jinja2 YAML初窥

    这一次的实验内容依然来自Kirk Byers的博客,源地址在https://pynet.twb-tech.com/blog/python/paramiko-ssh-part1.html 但是,这次实验 ...

  10. 关于ol有序裂变和ul无序列表前面的列表项标记的位置

    使用列表项标记的时候发现其对齐方式竟然从内容开始,于是发现了这个属性可以解决: list-style-position inside 列表项目标记放置在文本以内,且环绕文本根据标记对齐. outsid ...