reportng之测试报告升级美化
背景:偶然看到一个人的自动化框架的测试报告好漂亮,心痒痒,今天弄了一下午,还是不行,结果到现在就现在,我特么成功了,不为什么
Mark一下:
本地化修改
获取源码,修改reportng.properties文件,reportng.properties中的内容是键值对,修改后面的值为中文即可。其他视情况做改变。
passed=通过
修改测试结果顺序
需要修改TestResultComparator类,参考链接:
class TestResultComparator implements Comparator<ITestResult> {
publicintcompare(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;
}
}
主页添加饼图显示
主页的饼图用的是ichart开源图形组件.
主页的概括显示在overview.html.vm页面当中,先在文件中导入ichart组件。
title标签下
<script src='http://www.ichartjs.com/ichart.latest.min.js'></script>
添加饼图的标签<h1>下
<div id='ichart-render'></div>
给通过总数,失败总数和跳过总数添加id属性
<td class="passRate suite">之前添加,找到#if($totalPassed>0),为td标签,添加id属性,如下:
#if ($totalPassed > 0)
<td id="tpn" class="passed number">$totalPassed</td>
#else
<td id="tpn" class="zero number">0</td>
#end
#if ($totalSkipped > 0)
<td id="tsn" class="skipped number">$totalSkipped</td>
#else
<td id="tsn" class="zero number">0</td>
#end
#if ($totalFailed > 0)
<td id="tfn" class="failed number">$totalFailed</td>
#else
<td id="tfn" class="zero number">0</td>
#end
添加饼图显示的js代码
<script type='text/javascript'>
pcount=document.getElementById("tpn").innerHTML;
fcount=document.getElementById("tfn").innerHTML;
scount=document.getElementById("tsn").innerHTML;
$(function(){
var chart = iChart.create({
render:"ichart-render",
width:800,
height:400,
background_color:"#fefefe",
gradient:false,
color_factor:0.2,
border:{
color:"BCBCBC",
width:0
},
align:"center",
offsetx:0,
offsety:0,
sub_option:{
border:{
color:"#BCBCBC",
width:1
},
label:{
fontweight:500,
fontsize:11,
color:"#4572a7",
sign:"square",
sign_size:12,
border:{
color:"#BCBCBC",
width:1
}
}
},
shadow:true,
shadow_color:"#666666",
shadow_blur:2,
showpercent:false,
column_width:"70%",
bar_height:"70%",
radius:"90%",
subtitle:{
text:"",
color:"#111111",
fontsize:16,
font:"微软雅黑",
textAlign:"center",
height:20,
offsetx:0,
offsety:0
},
footnote:{
text:"",
color:"#111111",
fontsize:12,
font:"微软雅黑",
textAlign:"right",
height:20,
offsetx:0,
offsety:0
},
legend:{
enable:false,
background_color:"#fefefe",
color:"#333333",
fontsize:12,
border:{
color:"#BCBCBC",
width:1
},
column:1,
align:"right",
valign:"center",
offsetx:0,
offsety:0
},
coordinate:{
width:"80%",
height:"84%",
background_color:"#ffffff",
axis:{
color:"#a5acb8",
width:[1,"",1,""]
},
grid_color:"#d9d9d9",
label:{
fontweight:500,
color:"#666666",
fontsize:11
}
},
label:{
fontweight:500,
color:"#666666",
fontsize:11
},
type:"pie2d",
data:[
{
name:"通过",
value:pcount,
color:"#44aa44"
},{
name:"失败",
value:fcount,
color:"#ff4444"
},{
name:"跳过",
value:scount,
color:"#FFD700"
}
]
});
chart.draw();
});
</script>
饼图显示效果:

reportng之测试报告升级美化的更多相关文章
- Hexo博客Next v7.X 主题升级,美化警示录
本文转载于:Hexo博客Next v7.X 主题升级,美化警示录丨奥怪的小栈 前言 经历了好几天(懒癌晚期懒得数了)的与主题升级斗争后,我终于完成基本上完成了next主题的升级!升到了V7.3!哈哈哈 ...
- Mac Eclipse+Maven+TestNg+ReportNg 生成测试报告
TestNG 是java 的单元测试框架,功能很强大,很方便,但是自动生成的测试报告有待改善,可以使用TestNg 自带的TestNG_xslt更改TestNG报告的样式,这里主要讲解ReportNg ...
- Reportng 的测试报告在 Jenkins 中显示不全
通过Jenkins执行接口测试生成测试报告,用Jenkins的web服务打开html显示不全. 环境: Jenkins版本:1.651.2 Jenkins发布在mac上面 使用的是testng管理测试 ...
- Idea+maven+testng+reportng生成测试报告
TestNG自带的测试报告不是很好用,所以一般结合reportng生成美观的测试报告. 首先,在pom.xml中添加testng和reportng相关依赖 <dependencies> & ...
- TestNG之使用ReportNG生成测试报告
TestNG使用ReportNG生成测试报告会更加美观. 依赖包 <!--testNG报告依赖包--> <dependency> <groupId>org.test ...
- Eclipse+Maven+TestNg+ReportNg 生成测试报告
http://blog.csdn.net/a542551042/article/details/46729585
- ReportNg 测试报告的定制修改【转】
前言 前段时间在Testerhome上面看到了测试报告生成系列之-------如何用 testNG 生成测试报告 简单的描述了一些测试报告的生成,接着有人在评论中回复说可以针对reportNg的测试报 ...
- testng + reportng 测试结果邮件发送
https://blog.csdn.net/qq744746842/article/details/51497506 其实大多数的时候我们的测试报告的发送可能都是结合Jenkins发送的,所以这方面更 ...
- Allure--自动化测试报告生成
之前尝试使用过testNG自带的测试报告.优化过reportNG的测试报告,对这两个报告都不能满意.后经查找资料,发现有个神器: Allure(已经有allure2了,笔者使用的就是allure2), ...
随机推荐
- PAT 甲级 1057 Stack
https://pintia.cn/problem-sets/994805342720868352/problems/994805417945710592 Stack is one of the mo ...
- postman 学习网址
postman使用详解: http://gold.xitu.io/entry/57597a62a341310061337885 https://www.getpostman.com/docs/writ ...
- kvm安装配置
操作系统版本:CentOS Linux release 7.5.1804 (Core) 内核版本:3.10.0-862.el7.x86_64 1.安装 安装以下软件.yum -y install qe ...
- 1019C Sergey's problem(思维)
题意: 找出来一个点集S 使得S中的点不能互相通过一步到达 并且S中的点 可以在小于等于2的步数下到达所有的点 要父结点 不要子结点 这样就求出来一个点集S‘ 而S'中可能存在 v -> u ...
- 【刷题】BZOJ 3653 谈笑风生
Description 设T 为一棵有根树,我们做如下的定义: ? 设a和b为T 中的两个不同节点.如果a是b的祖先,那么称"a比b不知道 高明到哪里去了". ? 设a 和 b 为 ...
- HGOI 20181028 题解
HGOI 20181028(复赛备考) /* 真是暴力的一天,最后一题MLE?由于数组开得太大了!!! 270滚粗 考场上好像智商高了很多?!(假的) */ sol:暴力求解,然后没有数据范围吐槽一下 ...
- 解决 winform 界面对不齐
最近做了一个winform的程序,本机上界面对得很齐,到一到客户的机器上就惨不忍睹,一番研究后搞定: 1. AutoScaleMode = None 2. BackgroundImageLayout ...
- 洛谷 P2862 [USACO06JAN]把牛Corral the Cows 解题报告
P2862 [USACO06JAN]把牛Corral the Cows 题目描述 Farmer John wishes to build a corral for his cows. Being fi ...
- [Coderforces600E] Lomsat gelral
大意是每个点有一个颜色,询问以每个点为根的子树中出现次数最多的颜色是谁,如果有多个输出编号和. 这个东西用数据结构是不太好做的,考虑优化暴力. 首先最裸的的暴力就是在dfs序上跑莫队,但因为是树的结构 ...
- 目标检测评价指标(mAP)
常见指标 precision 预测出的所有目标中正确的比例 (true positives / true positives + false positives). recall 被正确定位识别的目标 ...