使用reportNG替换testNG的默认报告
关于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的默认报告的更多相关文章
- reportng代替testng的默认报告——pom设置
既然是maven项目,直接关注pom设置. 这篇写得很清楚了:maven+testng+reportng的pom设置 强调一点的是,guice必须依赖,就因这个卡了大半天. <dependenc ...
- [唐胡璐]Selenium技巧- ReportNG替换TestNG默认结果报告
TestNG默认的报告虽然内容挺全,但是展现效果却不太理想,不易阅读。因此我们想利用ReportNG来替代TestNG默认的report。 什么是ReportNG呢?这里不多说,请直接参见:http: ...
- ReportNG 替换testng过程中遇到的问题
1. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collectio ...
- ReportNG 替换testng获得测试报告
1.导入reportng相关jar包
- Maven与Ant使用reportNG代替testng
大家在使用TestNG时一定会发现其本身的报告生成不但简陋而且相当的不美观,而ReportNG正是一款为TestNG量身定做的报告生成插件,其报告美观.简约.清晰.漂亮的特点让很多TestNG开始慢慢 ...
- UI自动化测试篇 :ReportNG替代TestNG自带html版测试报告初探
转载http://www.cnblogs.com/chengtch/p/6071322.html “1.1.4版本的ReportNG是最后一个版本,之后不再做维护.作为一个简单的测试报告插件,它是创造 ...
- Jenkins进阶系列之——01使用email-ext替换Jenkins的默认邮件通知
1 简述 众所周知,Jenkins默认提供了一个邮件通知,能在构建失败.构建不稳定等状态后发送邮件.但是它本身有很多局限性,比如它的邮件通知无法提供详细的邮件内容.无法定义发送邮件的格式.无法定义灵活 ...
- Configuration ReportNG with TestNG
下载 Reporter.jar,velocity-dep-1.4.jar 和 Guice.jar: 配置项目属性:Properties ->TestNG ->Disable Default ...
- 替换Gravatar头像默认服务器
这几天Gravatar头像服务器应该集体被墙了,头像无法显示.兵来将挡,水来土掩,上有政策,下有对策,和谐社会靠大家,哈. 利用多说Gravatar头像中转服务器替代头像默认服务器. 将下面代码添加到 ...
随机推荐
- 与众不同 windows phone (40) - 8.0 媒体: 音乐中心的新增功能, 图片中心的新增功能, 后台音乐播放的新增功能
[源码下载] 与众不同 windows phone (40) - 8.0 媒体: 音乐中心的新增功能, 图片中心的新增功能, 后台音乐播放的新增功能 作者:webabcd 介绍与众不同 windows ...
- 与众不同 windows phone (48) - 8.0 其它: C# 调用 C++
[源码下载] 与众不同 windows phone (48) - 8.0 其它: C# 调用 C++ 作者:webabcd 介绍与众不同 windows phone 8.0 之 其它 C# 中调用 W ...
- 回文串--- Girls' research
HDU 3294 Problem Description One day, sailormoon girls are so delighted that they intend to resear ...
- java基础练习[一]
moka同学java学习笔记 package moka.hello; public class HelloWorld { public static void main(String[] ar ...
- Hibernate框架之关联映射入门
关联映射就是将关联关系映射到数据库里,在对象模型中就是一个或多个引用. 一:配置单向多对一关联 在Emp类中定义一个Dept属性,而在Dept类中无须定义用于存放Emp对象的集合属性 01.Dept. ...
- PHP 操作mongodb api大部分方法
<?php /* PHP mongodb * 全部curd操作 * @author:xiaojiang * @date: 2014-10-27 */ //查看 mongo类版本 1.30 以后版 ...
- 【GOF23设计模式】享元模式
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_享元模式.享元池.内部状态.外部状态.线程池.连接池 package com.test.flyweight; /** * ...
- 【GOF23设计模式】组合模式
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_组合模式.树状结构.杀毒软件架构.JUnite底层架构.常见开发场景 package com.test.composite ...
- 【GOF23设计模式】代理模式
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_代理模式.静态代理 package com.test.proxy.staticProxy; public interfac ...
- android 类ios actionsheet效果
1.http://blog.csdn.net/zhaoxy_thu/article/details/17733389 2. https://github.com/ojhariddhish/action ...