测试报告

##### 报告汇总

用例名称:
用例总数:
用例通过:
用例失败:
用例跳过:
开始时间:
运行时间:

##### 详细数据

测试类:
结果:
用例数: | 成功: | 失败: | 跳过:

编号 | 请求地址 | 响应结果 | 用例描述 | 耗时 | 结果 | 操作
--- | --- | --- | --- | --- | --- | ---

=======end1", "
", "
", "======================================== 下一个请求 ========================================", "
", "
", "" ] } ], "testName": "passportapi", "testAll": 1, "testFail": 0, "beginTime": "2020-05-11 18:50:53", "totalTime": "1s", "testSkip": 0, "testError": 0 }; function clickRow(obj){ $("#detailBody").children("tr").attr("style","font-family: Consolas"); $(obj).attr("style","font-family: Consolas; background-color: #b0d877"); } function details(obj) { if ($(obj).text() == '展开') { var len = $(obj).parent().parent().children().length; var detailLog = ""; var logs = resultData["testResult"][parseInt($(obj).attr("buttonIndex"))]["log"]; $(obj).text("收缩"); $(obj).removeClass("btn-primary"); $(obj).addClass("btn-danger"); $.each(logs, function (i, n) { detailLog = detailLog + "

" + n + "

"; }); $(obj).parent().parent().after("
" + detailLog + "
"); } else if ($(obj).text() == '收缩') { $(obj).parent().parent().next().remove(); $(obj).text("展开"); $(obj).removeClass("btn-danger"); $(obj).addClass("btn-primary"); } } $(function () { $("#testName").text(resultData["testName"]); $("#testPass").text(resultData["testPass"]); $("#testFail").text(resultData["testFail"]); $("#testSkip").text(resultData["testSkip"]); $("#testAll").text(resultData["testAll"]); $("#beginTime").text(resultData["beginTime"]); $("#totalTime").text(resultData["totalTime"]); $("#filterAll").text(resultData["testAll"]); $("#filterOk").text(resultData["testPass"]); $("#filterFail").text(resultData["testFail"]); $("#filterSkip").text(resultData["testSkip"]); var classNames = []; var results = []; $.each(resultData["testResult"], function (i, n) { if (classNames.indexOf(n["className"]) == -1) { classNames.push(n["className"]); } if (results.indexOf(n["status"]) == -1) { results.push(n["status"]); } }); $.each(classNames, function (i, n) { $("#filterClass").append("" + n + ""); }); $.each(results, function (i, n) { $("#filterResult").append("" + n + ""); }); $("#filterClass").chosen({search_contains: true}); $("#filterResult").chosen({search_contains: true}); function generateResult(className, caseResult) { $("#detailBody").children().remove(); var filterAll = 0; var filterOk = 0; var filterFail = 0; var filterSkip = 0; $.each(resultData["testResult"], function (i, n) { if ((className == "" || n["className"] == className) && (caseResult == "" || n["status"] == caseResult)) { filterAll += 1; var status = ""; if (n["status"] == '成功') { filterOk += 1; status = "成功"; } else if (n["status"] == '失败') { filterFail += 1; status = "失败"; } else if (n["status"] == '跳过') { filterSkip += 1; status = "跳过"; } else { status = "" + n["status"] + ""; } var tr = "
" + "" + (i + 1) + "" + "" + n["className"] + "" + "" + n["methodName"] + "" + "" + n["description"] + "" + "" + n["spendTime"] + "" + status + "
" $("#detailBody").append(tr); } }); $("#filterAll").text(filterAll); $("#filterOk").text(filterOk); $("#filterFail").text(filterFail); $("#filterSkip").text(filterSkip); } generateResult("", ""); $("#filterClass").on('change', function () { var className = $("#filterClass").val(); var caseResult = $("#filterResult").val(); generateResult(className, caseResult); }); $("#filterResult").on('change', function () { var className = $("#filterClass").val(); var caseResult = $("#filterResult").val(); generateResult(className, caseResult); }); //$(".chosen-select").trigger("chosen:updated"); function pie() { var option = { title: { text: '测试用例运行结果', subtext: '', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}
{b} : {c} ({d}%)" }, legend: { orient: 'vertical', left: 'left', data: ['失败', '跳过', '成功'] }, series: [ { name: '运行结果', type: 'pie', radius: '55%', center: ['50%', '60%'], data: [ {value: resultData["testFail"], name: '失败'}, {value: resultData["testSkip"], name: '跳过'}, {value: resultData["testPass"], name: '成功'} ], itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; var chart = echarts.init(document.getElementById("echarts-map-chart")); chart.setOption(option); } pie(); });