背景:偶然看到一个人的自动化框架的测试报告好漂亮,心痒痒,今天弄了一下午,还是不行,结果到现在就现在,我特么成功了,不为什么

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之测试报告升级美化的更多相关文章

  1. Hexo博客Next v7.X 主题升级,美化警示录

    本文转载于:Hexo博客Next v7.X 主题升级,美化警示录丨奥怪的小栈 前言 经历了好几天(懒癌晚期懒得数了)的与主题升级斗争后,我终于完成基本上完成了next主题的升级!升到了V7.3!哈哈哈 ...

  2. Mac Eclipse+Maven+TestNg+ReportNg 生成测试报告

    TestNG 是java 的单元测试框架,功能很强大,很方便,但是自动生成的测试报告有待改善,可以使用TestNg 自带的TestNG_xslt更改TestNG报告的样式,这里主要讲解ReportNg ...

  3. Reportng 的测试报告在 Jenkins 中显示不全

    通过Jenkins执行接口测试生成测试报告,用Jenkins的web服务打开html显示不全. 环境: Jenkins版本:1.651.2 Jenkins发布在mac上面 使用的是testng管理测试 ...

  4. Idea+maven+testng+reportng生成测试报告

    TestNG自带的测试报告不是很好用,所以一般结合reportng生成美观的测试报告. 首先,在pom.xml中添加testng和reportng相关依赖 <dependencies> & ...

  5. TestNG之使用ReportNG生成测试报告

    TestNG使用ReportNG生成测试报告会更加美观. 依赖包 <!--testNG报告依赖包--> <dependency> <groupId>org.test ...

  6. Eclipse+Maven+TestNg+ReportNg 生成测试报告

    http://blog.csdn.net/a542551042/article/details/46729585

  7. ReportNg 测试报告的定制修改【转】

    前言 前段时间在Testerhome上面看到了测试报告生成系列之-------如何用 testNG 生成测试报告 简单的描述了一些测试报告的生成,接着有人在评论中回复说可以针对reportNg的测试报 ...

  8. testng + reportng 测试结果邮件发送

    https://blog.csdn.net/qq744746842/article/details/51497506 其实大多数的时候我们的测试报告的发送可能都是结合Jenkins发送的,所以这方面更 ...

  9. Allure--自动化测试报告生成

    之前尝试使用过testNG自带的测试报告.优化过reportNG的测试报告,对这两个报告都不能满意.后经查找资料,发现有个神器: Allure(已经有allure2了,笔者使用的就是allure2), ...

随机推荐

  1. centos 7 安装搜狗输入法

    1.安装alien依赖软件sudo yum install alien -y 2.安装依赖软件sudo yum install qtwebkit -ysudo yum install fcitx -y ...

  2. Postgresql 简单安装过程. Study From https://www.cnblogs.com/stulzq/p/7766409.html

    CentOS 下面安装 Postgresql. 的简要学习记录 1. 卸载CentOS上面自带的postgresql版本 rpm -e $(rpm -qa|grep postgre) 2. postg ...

  3. SQL 中LTrim、RTrim与Trim的用法

    LTrim.RTrim与 Trim 函数 返回 Variant (String),其中包含指定字符串的拷贝,没有前导空白 (LTrim).尾随空白 (RTrim) 或前导和尾随空白 (Trim).语法 ...

  4. GCD LCM UVA - 11388 (思维。。水题)

    两个数的最小公倍数和最大公约数肯定是倍数关系 然后又让求使得a最小  因为 a = m * gcd 令m = 1 时 a取得最小  即gcd 则b = lcm #include <iostrea ...

  5. 浅入 dancing links x(舞蹈链算法)

    abastract:利用dancing links 解决精确覆盖问题,例如数独,n皇后问题:以及重复覆盖问题. 要学习dacning links 算法,首先要先了解该算法适用的问题,精确覆盖问题和重复 ...

  6. 【刷题】LOJ 6005 「网络流 24 题」最长递增子序列

    题目描述 给定正整数序列 \(x_1 \sim x_n\) ,以下递增子序列均为非严格递增. 计算其最长递增子序列的长度 \(s\) . 计算从给定的序列中最多可取出多少个长度为 \(s\) 的递增子 ...

  7. The Applications of RT-Thread RTOS

    The Applications of RT-Thread RTOS Introduction The user application is the application layer of RT- ...

  8. CF494C Helping People 解题报告

    CF494C Helping People 题意翻译 有一个长为 \(n\) 的数列,初始时为 \(a_{1\dots n}\). 给你 \(q\) 个操作,第 \(i\) 个操作将 \([l_i,r ...

  9. bzoj2456 mode (思路)

    不能把数存下来. 于是来打擂台,如果新数和他不相等,cnt--,否则cnt++.如果cnt<=0了,那个新数就来把它顶掉,然后把cnt重置成1 最后在台上的就是那个次数大于N/2的众数 (连&l ...

  10. adb logcat介绍

    logcat命令语法: [adb] logcat [<option>] ... [<filter-spec>] ... adb logcat -c 清除所有以前的日志 adb ...