refactor(接口测试): 修复接口测试报告统计不对的问题

--bug=1011419 --user=宋天阳 【接口测试】接口用例批量执行,集合报告,成功用例数统计错误
https://www.tapd.cn/55049933/s/1122786
This commit is contained in:
song-tianyang 2022-03-21 20:20:49 +08:00 committed by fit2-zhao
parent 87209b6dd9
commit 93ee0e5ac7
2 changed files with 19 additions and 10 deletions

View File

@ -193,7 +193,7 @@ public class ApiScenarioReportStructureService {
scenarioError.set(scenarioError.longValue() + 1);
} else if (StringUtils.equalsIgnoreCase(step.getTotalStatus(), "errorCode")) {
errorReport.set(errorReport.longValue() + 1);
} else {
} else if(!StringUtils.equalsIgnoreCase(step.getTotalStatus(), "success")){
unExecute.set(unExecute.longValue() + 1);
}
}
@ -388,6 +388,14 @@ public class ApiScenarioReportStructureService {
if (expandDTO.getAttachInfoMap() != null && expandDTO.getAttachInfoMap().get("errorReportResult") != null) {
treeDTO.setErrorCode(expandDTO.getAttachInfoMap().get("errorReportResult"));
treeDTO.setTotalStatus("errorCode");
}else if(StringUtils.isNotEmpty(expandDTO.getStatus())){
treeDTO.setTotalStatus(expandDTO.getStatus());
}else {
if(expandDTO.isSuccess()){
treeDTO.setTotalStatus("success");
}else {
treeDTO.setTotalStatus("fail");
}
}
}
@ -411,7 +419,7 @@ public class ApiScenarioReportStructureService {
reportDTO.setTotalAssertions(reportResults.stream().mapToLong(ApiDefinitionExecResultVo::getTotalAssertions).sum());
reportDTO = this.countReportNum(stepList, reportDTO);
long successStep = reportResults.size() - reportDTO.getError() - reportDTO.getScenarioErrorReport();
long successStep = reportResults.size() - reportDTO.getScenarioError() - reportDTO.getScenarioErrorReport() - reportDTO.getScenarioUnExecute();
reportDTO.setScenarioStepSuccess(successStep > 0 ? successStep : 0);
//统计步骤数据
reportDTO.setScenarioStepTotal(reportResults.size());

View File

@ -43,10 +43,10 @@
</div>
</div>
</div>
<el-divider v-if="content.unExecute > 0"></el-divider>
<div class="metric-icon-box" v-if="content.unExecute > 0" style="height: 26px">
<el-divider ></el-divider>
<div class="metric-icon-box" style="height: 26px">
<span class="ms-point-unexecute" style="margin: 7px;float: left;"/>
<div class="metric-box" v-if="content.unExecute > 0">
<div class="metric-box" >
<div class="value" style="font-size: 12px">{{ content.unExecute }}
{{ $t('api_test.home_page.detail_card.unexecute') }}
</div>
@ -81,8 +81,8 @@
<div class="value">{{ content.scenarioErrorReport ? content.scenarioErrorReport : 0 }}</div>
<div class="name">{{ $t('error_report_library.option.name') }}</div>
</div>
<span class="ms-point-unexecute" v-if="content.unExecute > 0 || content.unExecute > 0 "/>
<div class="metric-box" v-if="content.unExecute > 0 || content.unExecute > 0 ">
<span class="ms-point-unexecute"/>
<div class="metric-box">
<div class="value">{{ content.scenarioUnExecute ? content.scenarioUnExecute : 0 }}</div>
<div class="name">{{ $t('api_test.home_page.detail_card.unexecute') }}</div>
</div>
@ -92,7 +92,8 @@
<el-row type="flex" justify="center" align="middle">
<div class="metric-box">
<div class="value">{{ content.scenarioStepTotal ? content.scenarioStepTotal : 0 }}</div>
<div class="name">{{ $t('test_track.plan_view.step') }}</div>
<div class="name" v-if="report.reportType === 'API_INTEGRATED'">{{$t('api_test.definition.request.case')}}</div>
<div class="name" v-else>{{ $t('test_track.plan_view.step') }}</div>
</div>
<span class="ms-point-success"/>
<div class="metric-box">
@ -110,8 +111,8 @@
<div class="value">{{ content.scenarioStepErrorReport ? content.scenarioStepErrorReport : 0 }}</div>
<div class="name">{{ $t('error_report_library.option.name') }}</div>
</div>
<span class="ms-point-unexecute" v-if="content.unExecute > 0 || content.unExecute > 0 "/>
<div class="metric-box" v-if="content.unExecute > 0 || content.unExecute > 0 ">
<span class="ms-point-unexecute" />
<div class="metric-box">
<div class="value">{{
content.scenarioStepUnExecuteReport ? content.scenarioStepUnExecuteReport : 0
}}