关于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. .net多线程的发展

    APM和EAP是在async/await之前的两种不同的异步编程模式. APM如果不阻塞主线程,那么完成通知(回调)就会执行在另外一个线程中,从而给我们更新UI带来一定的问题. EAP的通知事件是在主 ...

  2. MySQL的字符集

    MySQL的字符集支持(Character Set Support)有两个方面:字符集(Character set)和排序方式(Collation). 字符(Character)是指人类语言中最小的表 ...

  3. fibonacci封闭公式

    Description 2007年到来了.经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列 (f[0]=0,f[1]=1;f[i] = f[i-1]+f ...

  4. 访问WEB-INFO 目录注意事项

    WEB-INF下面的内容都是只能由服务器级别才能访问,客户端并不能访问.什么是客户端级别?什么是服务器级别呢? 转发就是服务器级别,浏览器的地址不会变,因为,客户端发送一个请求,服务器受理之后,发现要 ...

  5. mysql查询今天,昨天,近7天,近30天,本月,上一月数据的方法(摘录)

    mysql查询今天,昨天,近7天,近30天,本月,上一月数据的方法分析总结: 话说有一文章表article,存储文章的添加文章的时间是add_time字段,该字段为int(5)类型的,现需要查询今天添 ...

  6. 【原创】使用.NET Core 1.0创建一个Self-Contained控制台应用

    开发机器:win7-x64 .NET Core版本:1.0.0-preview2-003121 Visual Studio Code:1.2.1 至于什么是Self-Contained应用类型以及与P ...

  7. xscript脚本

    最近看<游戏脚本高级编程>,然后顺便把里面实现的虚拟机,汇编器以及编译器手动用C++重写了一遍,原版书中提供的代码,风格不是很好,而且有几处BUG.我现在开源的代码中已经修复了BUG,而且 ...

  8. 安卓开发-See the log file\.metadata\.log.

    今天在给安卓项目res-valus-string.xml 中字符串修改的时候,突然eclipse卡住了 然后任务管理器关掉之后,重新打开 显示一个错误 百度了一下 eclipse启动报错,让查看.me ...

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

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

  10. 真机调试出现Could not find Developer Disk Image问题解决办法

    1.升级Xcode 2. 在使用Xcode进行真机调试的时候,有时根据真机的系统不同,会出现could not find developer disk image 错误,这是由于真机系统过高或者过低, ...