AutoFramework/Runner/API/1.html

661 lines
24 KiB
HTML
Raw Normal View History

2022-07-30 10:19:36 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 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: [1]
}, {
name: '失败',
color: '#f16d7e',
data: [0]
}, {
name: '错误',
color: '#fdc68c',
data: [2]
}]
})
// 增加饼状图
$('#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: [
['通过', 1], ['失败', 0], ['错误', 2]
]
}]
}, 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,'&amp;');
s = s.replace(/</g,'&lt;');
s = s.replace(/>/g,'&gt;');
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-07-30 01:01:38</p>
<p class='attribute'><strong>合计耗时 : </strong> 00:00:00</p>
<p class='attribute'><strong>测试结果 : </strong> 总共 3通过 1失败 0错误 2通过率 33.33%</p>
<p class='attribute'><strong>失败用例 : </strong></p>
<p class='attribute'><strong>错误用例 : </strong> <a class='showDetail' data-toggle='collapse' href='#errorsCaseOl' style='text-decoration: none;'>点击查看</a><ol id='errorsCaseOl' class='collapse' style='float: left; font-family: Menlo,Monaco,Consolas,monospace;'><li>main.测试用例.test0002_None</li><li>main.测试用例.test0003_None</li></ol></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)'>概要 33.33%</a>
<a class="btn btn-success" href='javascript:showCase(2)'>通过 1</a>
<a class="btn btn-danger" href='javascript:showCase(1)'>失败 0</a>
<a class="btn btn-warning" href='javascript:showCase(3)'>错误 2</a>
<a class="btn btn-info" href='javascript:showCase(4)'>全部 3</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='errorClass warning'>
<td>测试用例</td>
<td></td>
<td class="text-center">3</td>
<td class="text-center">1</td>
<td class="text-center">0</td>
<td class="text-center">2</td>
<td class="text-center">0.101秒</td>
<td class="text-center"><a href="javascript:showClassDetail('c1',3)" class="detail" id='c1'>查看全部</a></td>
</tr>
<tr id='pt1_1' class='hiddenRow'>
<td class='passedCase' style="vertical-align: middle"><div class='testcase'>test0001_TestLogin</div></td>
<td style="vertical-align: middle">正常登录</td>
<td colspan='5' align='center'>
<button id='btn_pt1_1' type="button" class="btn btn-xs" data-toggle="collapse" data-target='#div_pt1_1'>通过</button>
<div id='div_pt1_1' class="collapse in">
<pre style="text-align:left;font-size:12px;color:#e52000">pt1_1:
2022-07-30 01:01:38,956 - D: 正在执行:正常登录
2022-07-30 01:01:39,053 - D:
[-&gt;]
POST /filebox.php?op=home HTTP/1.1
Host: www.fanscloud.net
User-Agent: curl
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 59
Content-Type: application/x-www-form-urlencoded
user=&amp;pass=1234ABCDabcd&amp;submitButtonName=%E7%99%BB%E5%BD%95
[&lt;-]
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 29 Jul 2022 17:01:38 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Set-Cookie: PHPSESSID=8lr8duhbbqtch8t3iu3jq8gsn3; path=/, user=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0, pass=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Encoding: gzip
&lt;!DOCTYPE html&gt;
&lt;meta name='robots' content='noindex,follow' /&gt;
&lt;head&gt;
&lt;meta name='viewport' content='width=device-width, initial-scale=1'/&gt;
&lt;title&gt;www.fanscloud.net - 登录&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;style&gt;
*{font-family:'Consolas';}.box{border:1px solid #ccc;b ... [MORE 94% OMITTED HERE]
</pre>
</div>
</td>
<td class='passedCase' style="vertical-align: middle"></td>
</tr>
<tr id='et1_2' class='none'>
<td class='errorsCase' style="vertical-align: middle"><div class='testcase'>test0002_None</div></td>
<td style="vertical-align: middle"></td>
<td colspan='5' align='center'>
<button id='btn_et1_2' type="button" class="btn btn-xs" data-toggle="collapse" data-target='#div_et1_2'>错误</button>
<div id='div_et1_2' class="collapse in">
<pre style="text-align:left;font-size:12px;color:#e52000">et1_2:
2022-07-30 01:01:39,053 - D: 正在执行None
Traceback (most recent call last):
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc
return self._engine.get_loc(casted_key)
File "pandas\_libs\index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 2131, in pandas._libs.hashtable.Int64HashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 2140, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 171, in foo
def foo(self, index=i): return self._test_(index)
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 159, in test
self.test_unit(data=main_case)
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 116, in test_unit
HTTPCh = self.h.where((self.h['Env'] == self.envs) &amp; (self.h['Name'] == data['HTTPCh']), inplace=False).dropna(how='all').loc[0].to_dict()
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 967, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 1202, in _getitem_axis
return self._get_label(key, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 1153, in _get_label
return self.obj.xs(label, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\generic.py", line 3864, in xs
loc = index.get_loc(key)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexes\base.py", line 3623, in get_loc
raise KeyError(key) from err
KeyError: 0
</pre>
</div>
</td>
<td class='errorsCase' style="vertical-align: middle"></td>
</tr>
<tr id='et1_3' class='none'>
<td class='errorsCase' style="vertical-align: middle"><div class='testcase'>test0003_None</div></td>
<td style="vertical-align: middle"></td>
<td colspan='5' align='center'>
<button id='btn_et1_3' type="button" class="btn btn-xs" data-toggle="collapse" data-target='#div_et1_3'>错误</button>
<div id='div_et1_3' class="collapse in">
<pre style="text-align:left;font-size:12px;color:#e52000">et1_3:
2022-07-30 01:01:39,058 - D: 正在执行None
Traceback (most recent call last):
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexes\base.py", line 3621, in get_loc
return self._engine.get_loc(casted_key)
File "pandas\_libs\index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 2131, in pandas._libs.hashtable.Int64HashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 2140, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 171, in foo
def foo(self, index=i): return self._test_(index)
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 159, in test
self.test_unit(data=main_case)
File "D:\Project\AutoFramework\Runner\API\DefaultRunner.py", line 116, in test_unit
HTTPCh = self.h.where((self.h['Env'] == self.envs) &amp; (self.h['Name'] == data['HTTPCh']), inplace=False).dropna(how='all').loc[0].to_dict()
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 967, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 1202, in _getitem_axis
return self._get_label(key, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexing.py", line 1153, in _get_label
return self.obj.xs(label, axis=axis)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\generic.py", line 3864, in xs
loc = index.get_loc(key)
File "D:\Project\AutoFramework\venv\lib\site-packages\pandas\core\indexes\base.py", line 3623, in get_loc
raise KeyError(key) from err
KeyError: 0
</pre>
</div>
</td>
<td class='errorsCase' style="vertical-align: middle"></td>
</tr>
<tr id='total_row' class="text-center active">
<td colspan='2'>总计</td>
<td>3</td>
<td>1</td>
<td>0</td>
<td>2</td>
<td>0.101秒</td>
<td>通过33.33%</td>
</tr>
</table>
<div id='footer'>&nbsp;</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>