583 lines
21 KiB
HTML
583 lines
21 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<title>测试报告</title>
|
||
<meta name="generator" content="HTMLTestRunner"/>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
||
<link rel="stylesheet" href="https://www.fanscloud.net/res/bootstrap/3.0.3/css/bootstrap.min.css">
|
||
<script src="https://www.fanscloud.net/res/jquery/2.0.0/jquery.min.js"></script>
|
||
<script src="https://www.fanscloud.net/res/bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
|
||
<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
|
||
|
||
<style type="text/css" media="screen">
|
||
body { font-family: Microsoft YaHei;padding: 20px; font-size: 100%; }
|
||
table { font-size: 100%; }
|
||
.table tbody tr td{
|
||
vertical-align: middle;
|
||
}
|
||
|
||
/* -- header ---------------------------------------------------------------------- */
|
||
.header .description, .attribute {
|
||
clear: both;
|
||
}
|
||
|
||
/* --- 失败和错误合集样式 -- Gelomen --- */
|
||
.failCollection, .errorCollection {
|
||
width: auto;
|
||
float: left;
|
||
}
|
||
#failedCaseOl li {
|
||
color: red
|
||
}
|
||
#errorsCaseOl li {
|
||
color: orange
|
||
}
|
||
|
||
/* --- 打开截图特效样式 -- Gelomen --- */
|
||
.data-img{
|
||
cursor:pointer
|
||
}
|
||
|
||
.pic_looper{
|
||
width:100%;
|
||
height:100%;
|
||
position: fixed;
|
||
left: 0;
|
||
top:0;
|
||
opacity: 0.6;
|
||
background: #000;
|
||
display: none;
|
||
z-index: 100;
|
||
}
|
||
|
||
.pic_show{
|
||
width:100%;
|
||
position:fixed;
|
||
left:0;
|
||
top:0;
|
||
right:0;
|
||
bottom:0;
|
||
margin:auto;
|
||
text-align: center;
|
||
display: none;
|
||
z-index: 100;
|
||
}
|
||
|
||
.pic_box{
|
||
padding:10px;
|
||
width:90%;
|
||
height:90%;
|
||
margin:40px auto;
|
||
text-align: center;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.pic_box img{
|
||
max-width: 100%;
|
||
max-height: 100%;
|
||
width: auto;
|
||
height: auto;
|
||
-moz-box-shadow: 0px 0px 20px 0px #000;
|
||
-webkit-box-shadow: 0px 0px 20px 0px #000;
|
||
box-shadow: 0px 0px 20px 0px #000;
|
||
}
|
||
|
||
/* --- 饼状图样式 */
|
||
#container {
|
||
max-width: 100%;
|
||
width: 450px;
|
||
height: 350px;
|
||
float: left;
|
||
}
|
||
#container_extend {
|
||
max-width: 100%;
|
||
width: 550px;
|
||
height: 400px;
|
||
float: left;
|
||
}
|
||
|
||
|
||
/* -- report ------------------------------------------------------------------------ */
|
||
#total_row { font-weight: bold; }
|
||
.passedCase { color: #3FB83F; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; font-size: 14px; font-weight: bold; }
|
||
.failedCase { color: #D9433F; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; font-size: 14px; font-weight: bold; }
|
||
.errorsCase { color: #F0A02F; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; font-size: 14px; font-weight: bold; }
|
||
.hiddenRow { display: none; }
|
||
.testcase { margin-left: 1em; word-break: break-all; white-space: pre-wrap; }
|
||
.screenshot:link { text-decoration: none;color: deeppink; }
|
||
.screenshot:visited { text-decoration: none;color: deeppink; }
|
||
.screenshot:hover { text-decoration: none;color: darkcyan; }
|
||
.screenshot:active { text-decoration: none;color: deeppink; }
|
||
</style>
|
||
|
||
</head>
|
||
<body >
|
||
<script language="javascript" type="text/javascript">
|
||
|
||
$(function(){
|
||
// 修改 失败 和 错误 用例里对应按钮的颜色ClassName为动态加载 -- Gelomen
|
||
$("button").each(function () {
|
||
var text = $(this).text();
|
||
if(text == "失败"){
|
||
$(this).addClass("btn-danger")
|
||
}else if(text == "错误") {
|
||
$(this).addClass("btn-warning")
|
||
}else if(text == "通过") {
|
||
$(this).addClass("btn-success")
|
||
}
|
||
});
|
||
|
||
// 给失败和错误合集加样式 -- Gelomen
|
||
var p_attribute = $("p.attribute");
|
||
p_attribute.eq(4).addClass("failCollection");
|
||
p_attribute.eq(5).addClass("errorCollection");
|
||
|
||
// 打开截图,放大,点击任何位置可以关闭图片
|
||
$(".screenshot").click(function(){
|
||
var img = $(this).attr("img");
|
||
$('.pic_show img').attr('src', img);
|
||
$('.pic_looper').fadeIn(200);
|
||
$('.pic_show').fadeIn(200);
|
||
|
||
var browserHeight = $(window).height();
|
||
var pic_boxHeight = $(".pic_box").height();
|
||
var top = (browserHeight - pic_boxHeight)/2;
|
||
$('.pic_box').css("margin-top", top + "px")
|
||
|
||
});
|
||
$('.pic_looper, .pic_show').click(function(){
|
||
$('.pic_looper').fadeOut(200);
|
||
$('.pic_show').fadeOut(200)
|
||
});
|
||
|
||
var resize_action = function(){
|
||
// 改变窗口大小时,自动改变图表边距
|
||
var browserWidth = $(window).width();
|
||
var margin_left = browserWidth - 360 - 450 - 550 - 40;
|
||
if(margin_left <= 0){
|
||
$("#container").css("width", "100%");
|
||
$("#container_extend").css("width", "100%");
|
||
$("#testinfo").css("width", "100%");
|
||
$("#container").css("margin-left", "0px");
|
||
}else {
|
||
$("#container").css("width", "450px");
|
||
$("#container_extend").css("width", "550px");
|
||
$("#testinfo").css("width", "25%");
|
||
$("#container").css("margin-left", (margin_left - 1 - 16) + "px");
|
||
}
|
||
}
|
||
resize_action();
|
||
|
||
$(window).resize(function(){
|
||
// 改变窗口大小时,自动改变图片与顶部的距离
|
||
var browserHeight = $(window).height();
|
||
var pic_boxHeight = $(".pic_box").height();
|
||
var top = (browserHeight - pic_boxHeight)/2;
|
||
$('.pic_box').css("margin-top", top + "px");
|
||
resize_action();
|
||
});
|
||
// 超过浏览器高度时,回到顶部按钮出现
|
||
$(window).scroll(function(){
|
||
var browserHeight = $(window).height();
|
||
var top = $(window).scrollTop();
|
||
if(top >= browserHeight){
|
||
$("#toTop").css("display", "block")
|
||
}else {
|
||
$("#toTop").css("display", "none")
|
||
}
|
||
})
|
||
// 增加回到顶部过程动画
|
||
$("#toTop").click(function() {
|
||
$("html,body").animate({"scrollTop":0}, 500)
|
||
})
|
||
// 增加条形图
|
||
$('#container_extend').highcharts({
|
||
chart: {
|
||
type: 'bar'
|
||
},
|
||
credits: {
|
||
enabled: false
|
||
},
|
||
navigation: {
|
||
buttonOptions: {
|
||
enabled: false
|
||
}
|
||
},
|
||
title: {
|
||
text: '用例集合情况'
|
||
},
|
||
xAxis: {
|
||
categories: ["测试用例"]
|
||
},
|
||
yAxis: {
|
||
min: 0,
|
||
title: {
|
||
text: '用例数量'
|
||
},
|
||
reversedStacks: false
|
||
},
|
||
legend: {
|
||
reversed: false
|
||
},
|
||
plotOptions: {
|
||
series: {
|
||
stacking: 'normal'
|
||
}
|
||
},
|
||
series: [{
|
||
name: '通过',
|
||
color: '#64bb64',
|
||
data: [5]
|
||
}, {
|
||
name: '失败',
|
||
color: '#f16d7e',
|
||
data: [1]
|
||
}, {
|
||
name: '错误',
|
||
color: '#fdc68c',
|
||
data: [0]
|
||
}]
|
||
})
|
||
// 增加饼状图
|
||
$('#container').highcharts({
|
||
chart: {
|
||
plotBackgroundColor: null,
|
||
plotBorderWidth: null,
|
||
plotShadow: false,
|
||
spacing : [0, 0, 0, 0]
|
||
},
|
||
credits: {
|
||
enabled: false
|
||
},
|
||
navigation: {
|
||
buttonOptions: {
|
||
enabled: false
|
||
}
|
||
},
|
||
title: {
|
||
floating: true,
|
||
text: '测试结果占比'
|
||
},
|
||
tooltip: {
|
||
pointFormat: '<text style="font-size:10px">{series.name}: {point.percentage:.1f}%</text>'
|
||
},
|
||
plotOptions: {
|
||
pie: {
|
||
allowPointSelect: true,
|
||
cursor: 'pointer',
|
||
colors: ['#64bb64', '#f16d7e', '#fdc68c'],
|
||
dataLabels: {
|
||
enabled: true,
|
||
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
|
||
style: {
|
||
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
|
||
}
|
||
},
|
||
point: {
|
||
events: {
|
||
mouseOver: function(e) { // 鼠标滑过时动态更新标题
|
||
chart.setTitle({
|
||
text: e.target.name+ '\t'+ e.target.y + ' 个'
|
||
});
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
series: [{
|
||
type: 'pie',
|
||
innerSize: '80%',
|
||
name: '比例',
|
||
data: [
|
||
['通过', 5], ['失败', 1], ['错误', 0]
|
||
]
|
||
}]
|
||
}, function(c) {
|
||
// 环形圆心
|
||
var centerY = c.series[0].center[1],
|
||
titleHeight = parseInt(c.title.styles.fontSize);
|
||
c.setTitle({
|
||
x:0,
|
||
y:centerY + titleHeight/2
|
||
});
|
||
chart = c;
|
||
});
|
||
|
||
// 查看 失败 和 错误 合集链接文字切换 -- Gelomen
|
||
$(".showDetail").click(function () {
|
||
if($(this).html() == "点击查看"){
|
||
$(this).html("点击收起")
|
||
}else {
|
||
$(this).html("点击查看")
|
||
}
|
||
})
|
||
});
|
||
|
||
|
||
output_list = Array();
|
||
|
||
/*level 调整增加只显示通过用例的分类 --Findyou / 修复筛选显示bug --Gelomen
|
||
0:Summary //all hiddenRow
|
||
1:Failed //pt&et hiddenRow, ft none
|
||
2:Passed //pt none, ft&et hiddenRow
|
||
3:Errors //pt&ft hiddenRow, et none
|
||
4:All //all none
|
||
*/
|
||
function showCase(level) {
|
||
trs = document.getElementsByTagName("tr");
|
||
for (var i = 0; i < trs.length; i++) {
|
||
tr = trs[i];
|
||
id = tr.id;
|
||
if (id.substr(0,2) == 'ft') {
|
||
if (level == 2 || level == 0 || level == 3) {
|
||
tr.className = 'hiddenRow';
|
||
}
|
||
else {
|
||
tr.className = '';
|
||
// 切换筛选时只显示预览 -- Gelomen
|
||
// 失败
|
||
$("div[id^='div_ft']").attr("class", "collapse");
|
||
$("div[id^='div_et']").attr("class", "collapse");
|
||
$("div[id^='div_pt']").attr("class", "collapse");
|
||
}
|
||
}
|
||
if (id.substr(0,2) == 'pt') {
|
||
if (level == 1 || level == 0 || level == 3) {
|
||
tr.className = 'hiddenRow';
|
||
}
|
||
else {
|
||
tr.className = '';
|
||
// 切换筛选时只显示预览 -- Gelomen
|
||
// 通过
|
||
$("div[id^='div_ft']").attr("class", "collapse");
|
||
$("div[id^='div_et']").attr("class", "collapse");
|
||
$("div[id^='div_pt']").attr("class", "collapse");
|
||
}
|
||
}
|
||
if (id.substr(0,2) == 'et') {
|
||
if (level == 1 || level == 0 || level == 2) {
|
||
tr.className = 'hiddenRow';
|
||
}
|
||
else {
|
||
tr.className = '';
|
||
// 切换筛选时只显示预览 -- Gelomen
|
||
// 错误
|
||
$("div[id^='div_ft']").attr("class", "collapse");
|
||
$("div[id^='div_et']").attr("class", "collapse");
|
||
$("div[id^='div_pt']").attr("class", "collapse");
|
||
}
|
||
}
|
||
}
|
||
|
||
//加入详细切换文字变化
|
||
detail_class=document.getElementsByClassName('detail');
|
||
if (level == 4) {
|
||
for (var i = 0; i < detail_class.length; i++){
|
||
detail_class[i].innerHTML="收起"
|
||
}
|
||
}
|
||
else{
|
||
for (var i = 0; i < detail_class.length; i++){
|
||
detail_class[i].innerHTML="详细"
|
||
}
|
||
}
|
||
}
|
||
|
||
function showClassDetail(cid, count) {
|
||
var id_list = Array(count);
|
||
var toHide = 1;
|
||
for (var i = 0; i < count; i++) {
|
||
//ID修改.为_
|
||
tid0 = 't' + cid.substr(1) + '_' + (i+1);
|
||
tid = 'f' + tid0;
|
||
tr = document.getElementById(tid);
|
||
if (!tr) {
|
||
tid = 'p' + tid0;
|
||
tr = document.getElementById(tid);
|
||
if (!tr) {
|
||
tid = 'e' + tid0;
|
||
tr = document.getElementById(tid);
|
||
}
|
||
}
|
||
id_list[i] = tid;
|
||
if (tr.className) {
|
||
toHide = 0;
|
||
}
|
||
}
|
||
for (var i = 0; i < count; i++) {
|
||
tid = id_list[i];
|
||
//修改点击无法收起的BUG,加入【详细】切换文字变化 --Findyou
|
||
if (toHide) {
|
||
document.getElementById(tid).className = 'hiddenRow';
|
||
document.getElementById(cid).innerText = "详细"
|
||
}
|
||
else {
|
||
document.getElementById(tid).className = '';
|
||
document.getElementById(cid).innerText = "收起"
|
||
}
|
||
}
|
||
}
|
||
|
||
function html_escape(s) {
|
||
s = s.replace(/&/g,'&');
|
||
s = s.replace(/</g,'<');
|
||
s = s.replace(/>/g,'>');
|
||
return s;
|
||
}
|
||
</script>
|
||
|
||
<div class='pic_looper'></div>
|
||
<div class='pic_show'>
|
||
<div class='pic_box'>
|
||
<img src=''/>
|
||
</div>
|
||
</div>
|
||
<div class='header'>
|
||
<div id="testinfo" style="max-width: 360px; width: auto; float: left;">
|
||
<h1 style="margin: 5px 0px 10px 0px; font-family: Microsoft YaHei;">测试报告</h1>
|
||
|
||
<p class='attribute'><strong>开始时间 : </strong> 2022-08-09 18:30:10</p>
|
||
|
||
<p class='attribute'><strong>合计耗时 : </strong> 00:00:01</p>
|
||
|
||
<p class='attribute'><strong>测试结果 : </strong> 总共 6,通过 5,失败 1,错误 0,通过率 83.33%</p>
|
||
|
||
<p class='attribute'><strong>失败用例 : </strong> <a class='showDetail' data-toggle='collapse' href='#failedCaseOl' style='text-decoration: none;'>点击查看</a><ol id='failedCaseOl' class='collapse' style='float: left; font-family: Menlo,Monaco,Consolas,monospace;'><li>main.测试用例.test0006_None</li></ol></p>
|
||
|
||
<p class='attribute'><strong>错误用例 : </strong> 无</p>
|
||
|
||
<p class='description'></p>
|
||
</div>
|
||
<div id="container"></div>
|
||
<div id="container_extend"></div>
|
||
</div>
|
||
|
||
|
||
<div style="width: auto; clear: both;">
|
||
<p id='show_detail_line'>
|
||
<a class="btn btn-primary" href='javascript:showCase(0)'>概要 83.33%</a>
|
||
<a class="btn btn-success" href='javascript:showCase(2)'>通过 5</a>
|
||
<a class="btn btn-danger" href='javascript:showCase(1)'>失败 1</a>
|
||
<a class="btn btn-warning" href='javascript:showCase(3)'>错误 0</a>
|
||
<a class="btn btn-info" href='javascript:showCase(4)'>全部 6</a>
|
||
</p>
|
||
</div>
|
||
<table id='result_table' class="table table-condensed table-bordered table-hover">
|
||
<colgroup>
|
||
<col align='left' style="width: 300px;"/>
|
||
<col align='right' style="width: 285px;"/>
|
||
<col align='right' />
|
||
<col align='right' />
|
||
<col align='right' />
|
||
<col align='right' />
|
||
<col align='right' />
|
||
<col align='right' style="width: 120px;"/>
|
||
</colgroup>
|
||
<tr id='header_row' class="text-center success" style="font-weight: bold;font-size: 14px;">
|
||
<td>测试用例</td>
|
||
<td>说明</td>
|
||
<td>总计</td>
|
||
<td>通过</td>
|
||
<td>失败</td>
|
||
<td>错误</td>
|
||
<td>耗时</td>
|
||
<td>详细</td>
|
||
</tr>
|
||
|
||
<tr class='failClass warning'>
|
||
<td>测试用例</td>
|
||
<td></td>
|
||
<td class="text-center">6</td>
|
||
<td class="text-center">5</td>
|
||
<td class="text-center">1</td>
|
||
<td class="text-center">0</td>
|
||
<td class="text-center">1.123秒</td>
|
||
<td class="text-center"><a href="javascript:showClassDetail('c1',6)" class="detail" id='c1'>查看全部</a></td>
|
||
</tr>
|
||
|
||
<tr id='pt1_1' class='hiddenRow'>
|
||
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0001_None</div></td>
|
||
<td style="vertical-align: left"></td>
|
||
<td colspan='5' align='center'><button type="button" class="btn btn-xs">通过</button></td>
|
||
<td class='passedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='pt1_2' class='hiddenRow'>
|
||
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0002_None</div></td>
|
||
<td style="vertical-align: left"></td>
|
||
<td colspan='5' align='center'><button type="button" class="btn btn-xs">通过</button></td>
|
||
<td class='passedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='pt1_3' class='hiddenRow'>
|
||
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0003_None</div></td>
|
||
<td style="vertical-align: left"></td>
|
||
<td colspan='5' align='center'><button type="button" class="btn btn-xs">通过</button></td>
|
||
<td class='passedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='pt1_4' class='hiddenRow'>
|
||
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0004_None</div></td>
|
||
<td style="vertical-align: left"></td>
|
||
<td colspan='5' align='center'><button type="button" class="btn btn-xs">通过</button></td>
|
||
<td class='passedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='pt1_5' class='hiddenRow'>
|
||
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0005_None</div></td>
|
||
<td style="vertical-align: left"></td>
|
||
<td colspan='5' align='center'><button type="button" class="btn btn-xs">通过</button></td>
|
||
<td class='passedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='ft1_6' class='none'>
|
||
<td class='failedCase' style="vertical-align: middle"><div class='testcase'>test0006_None</div></td>
|
||
<td style="vertical-align: middle"></td>
|
||
<td colspan='5' align='center'>
|
||
<button id='btn_ft1_6' type="button" class="btn btn-xs" data-toggle="collapse" data-target='#div_ft1_6'>失败</button>
|
||
<div id='div_ft1_6' class="collapse in">
|
||
<pre style="text-align:left;font-size:12px;color:#e52000">ft1_6:
|
||
Traceback (most recent call last):
|
||
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 499, in foo
|
||
return self._test_(index)
|
||
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 484, in test
|
||
self.test_unit(data=main_case)
|
||
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 452, in test_unit
|
||
exec('%s(%s, %s)' % (operator['method'], formula_args[0], formula_args[1]))
|
||
File "<string>", line 1, in <module>
|
||
AssertionError: 'nginx2' not found in {'Server': 'nginx', 'Date': 'Tue, 09 Aug 2022 10:30:12 GMT', 'Content-Type': 'application/json', 'Content-Length': '208', 'Last-Modified': 'Thu, 04 Aug 2022 07:51:36 GMT', 'Connection': 'keep-alive', 'ETag': '"62eb7a88-d0"', 'Accept-Ranges': 'bytes', '_': 'Server: nginx\nDate: Tue, 09 Aug 2022 10:30:12 GMT\nContent-Type: application/json\nContent-Length: \'208\'\nLast-Modified: Thu, 04 Aug 2022 07:51:36 GMT\nConnection: keep-alive\nETag: \'"62eb7a88-d0"\'\nAccept-Ranges: bytes\n'}
|
||
</pre>
|
||
</div>
|
||
</td>
|
||
<td class='failedCase' style="vertical-align: middle"></td>
|
||
</tr>
|
||
|
||
<tr id='total_row' class="text-center active">
|
||
<td colspan='2'>总计</td>
|
||
<td>6</td>
|
||
<td>5</td>
|
||
<td>1</td>
|
||
<td>0</td>
|
||
<td>1.123秒</td>
|
||
<td>通过:83.33%</td>
|
||
</tr>
|
||
</table>
|
||
|
||
|
||
<div id='footer'> </div>
|
||
<div id="toTop" style="position:fixed;right:50px; bottom:30px; width:20px; height:20px;cursor:pointer; display: none">
|
||
<a>
|
||
<span class="glyphicon glyphicon-eject" style = "font-size:28px;color:#b0b0b0" aria-hidden="true">
|
||
</span>
|
||
</a>
|
||
</div>
|
||
|
||
<div style='width: auto; height: auto; border: 1px solid #e3e3e3; text-align: center; color: #505050; padding: 4px 0px 4px 0px;'>
|
||
<img src='' style='width: auto; height: auto; max-height: 40px;'>
|
||
<a href='#' style='font-size: 14px; color: #505050; text-align: center|bottom;'></a>
|
||
</div>
|
||
</body>
|
||
</html>
|