关于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. Servlet获得Http请求,GET/POST

    Servlet获得Http请求 Http请求信息格式 请求行(方法提交方式,URI,Http协议版本) GET方式提交:URI会包含查询字符串 POST方式提交:URI不会包含查询字符串 请求头 Ho ...

  2. jdbcTemplate 泛型 查询

    1. dao层方法使用泛型 public <T> List<T> findDistinctListByCondition(String str, Class<T> ...

  3. MAC 隐藏文件的显示

    显示 defaults write com.apple.finder AppleShowAllFiles -bool true 隐藏 defaults write com.apple.finder A ...

  4. Linux chmod命令详解

    Linux chmod命令详解 chmod----改变一个或多个文件的存取模式(mode)   chmod [options] mode files   只能文件属主或特权用户才能使用该功能来改变文件 ...

  5. jQuery waterbubble 水球图

    在线实例 默认效果 显示文本 水球半径 文本颜色 边框宽度 设置字体 数据多少 是否显示波纹 水球颜色 是否显示动画 使用方法 <div class="wrap"> & ...

  6. Postman的使用

    在我们平时开发中,特别是需要与接口打交道时,无论是写接口还是用接口,拿到接口后肯定都得提前测试一下,这样的话就非常需要有一个比较给力的Http请求模拟工具,现在流行的这种工具也挺多的,像火狐浏览器插件 ...

  7. 由于无法在数据库 'TestNonContainedDB' 上放置锁 ALTER DATABASE 失败

    Error: 消息5601,级别16,状态1,第1行,由于无法在数据库 'TestNonContainedDB' 上放置锁,ALTER DATABASE 失败.请稍后再试.消息5069,级别16,状态 ...

  8. 结合源代码详解android消息模型

    Handler是整个消息系统的核心,是Handler向MessageQueue发送的Message,最后Looper也是把消息通知给Handler,所以就从Handler讲起. 一.Handler H ...

  9. iOS第三方类库JSPatch(热更新)

    ---------------------------------------------------------------------------------------------------- ...

  10. Retrofit源码设计模式解析(下)

    本文将接着<Retrofit源码设计模式解析(上)>,继续分享以下设计模式在Retrofit中的应用: 适配器模式 策略模式 观察者模式 单例模式 原型模式 享元模式 一.适配器模式 在上 ...