feat(接口测试): 修复批量执行用例的集合报告不显示未执行统计的问题

--bug=1011394 --user=宋天阳 【接口测试】接口用例批量执行-集合报告里没有未执行状态
https://www.tapd.cn/55049933/s/1120950
This commit is contained in:
song-tianyang 2022-03-18 14:50:16 +08:00 committed by fit2-zhao
parent fe30cc441c
commit 6e880576ca
2 changed files with 314 additions and 295 deletions

View File

@ -210,6 +210,11 @@ public class ApiScenarioReportStructureService {
} else {
totalTime.set((totalTime.longValue() + (step.getValue().getEndTime() - step.getValue().getStartTime())));
}
//判断是否是未执行
if (step.getValue() instanceof RequestResultExpandDTO
&& StringUtils.equalsIgnoreCase(((RequestResultExpandDTO) step.getValue()).getStatus(), "unexecute")) {
unExecute.set(unExecute.longValue() + 1);
}
}
if (CollectionUtils.isNotEmpty(step.getChildren())) {
calculate(step.getChildren(), totalScenario, scenarioError, totalTime, errorReport, unExecute, isErrorFirst);
@ -328,7 +333,8 @@ public class ApiScenarioReportStructureService {
// 组装报告
if (CollectionUtils.isNotEmpty(reportResults)) {
reportDTO.setTotal(reportResults.size());
reportDTO.setError(reportResults.stream().filter(e -> StringUtils.equalsAnyIgnoreCase(e.getStatus(), "Error", "STOP")).collect(Collectors.toList()).size());
reportDTO.setError(reportResults.stream().filter(e -> StringUtils.equalsAnyIgnoreCase(e.getStatus(), "Error")).collect(Collectors.toList()).size());
reportDTO.setUnExecute(reportResults.stream().filter(e -> StringUtils.equalsAnyIgnoreCase(e.getStatus(), "STOP")).collect(Collectors.toList()).size());
reportDTO.setErrorCode(reportResults.stream().filter(e -> StringUtils.isNotEmpty(e.getErrorCode())).collect(Collectors.toList()).size());
reportDTO.setPassAssertions(reportResults.stream().mapToLong(ApiDefinitionExecResultVo::getPassAssertions).sum());
reportDTO.setTotalAssertions(reportResults.stream().mapToLong(ApiDefinitionExecResultVo::getTotalAssertions).sum());
@ -338,6 +344,7 @@ public class ApiScenarioReportStructureService {
//统计步骤数据
reportDTO.setScenarioStepTotal(reportResults.size());
reportDTO.setScenarioStepError(reportDTO.getError());
reportDTO.setScenarioStepUnExecuteReport(reportDTO.getUnExecute());
reportDTO.setScenarioStepErrorReport(0);
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();

View File

@ -17,7 +17,8 @@
<span class="ms-req-span"> {{ content.success ? content.success + content.error : 0 }} 请求</span>
</span>
</div>
<ms-chart id="chart" ref="chart" :options="options" :height="220" style="margin-right: 10px" :autoresize="true" v-else/>
<ms-chart id="chart" ref="chart" :options="options" :height="220" style="margin-right: 10px"
:autoresize="true" v-else/>
<el-row type="flex" justify="center" align="middle" style="width: 150px">
<div>
<div class="metric-icon-box" style="height: 26px">
@ -37,14 +38,18 @@
<div class="metric-icon-box" v-if="content.errorCode > 0" style="height: 26px">
<span class="ms-point-error-code" style="margin: 7px;float: left;"/>
<div class="metric-box" v-if="content.errorCode > 0">
<div class="value" style="font-size: 12px">{{ content.errorCode }} {{ $t('error_report_library.option.name') }}</div>
<div class="value" style="font-size: 12px">{{ content.errorCode }}
{{ $t('error_report_library.option.name') }}
</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">
<span class="ms-point-unexecute" style="margin: 7px;float: left;"/>
<div class="metric-box" v-if="content.unExecute > 0">
<div class="value" style="font-size: 12px">{{ content.unExecute }} {{ $t('api_test.home_page.detail_card.unexecute') }}</div>
<div class="value" style="font-size: 12px">{{ content.unExecute }}
{{ $t('api_test.home_page.detail_card.unexecute') }}
</div>
</div>
</div>
</div>
@ -70,7 +75,8 @@
<div class="value">{{ content.scenarioError ? content.scenarioError : 0 }}</div>
<div class="name">{{ $t('api_report.fail') }}</div>
</div>
<span class="ms-point-error-code" v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 "/>
<span class="ms-point-error-code"
v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 "/>
<div class="metric-box" v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 ">
<div class="value">{{ content.scenarioErrorReport ? content.scenarioErrorReport : 0 }}</div>
<div class="name">{{ $t('error_report_library.option.name') }}</div>
@ -98,14 +104,18 @@
<div class="value">{{ content.scenarioStepError ? content.scenarioStepError : 0 }}</div>
<div class="name">{{ $t('api_report.fail') }}</div>
</div>
<span class="ms-point-error-code" v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 "/>
<span class="ms-point-error-code"
v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 "/>
<div class="metric-box" v-if="content.scenarioErrorReport > 0 || content.scenarioStepErrorReport > 0 ">
<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 ">
<div class="value">{{ content.scenarioStepUnExecuteReport ? content.scenarioStepUnExecuteReport : 0 }}</div>
<div class="value">{{
content.scenarioStepUnExecuteReport ? content.scenarioStepUnExecuteReport : 0
}}
</div>
<div class="name">{{ $t('api_test.home_page.detail_card.unexecute') }}</div>
</div>
</el-row>
@ -199,7 +209,7 @@
computed: {
options() {
return {
color: ['#67C23A', '#F56C6C' ,'#F6972A'],
color: ['#67C23A', '#F56C6C', '#F6972A', '#9C9B9A'],
tooltip: {
trigger: 'item',
formatter: '{b}: {c} ({d}%)'
@ -243,6 +253,7 @@
{value: this.content.success},
{value: this.content.error},
{value: this.content.errorCode},
{value: this.content.unExecute},
]
}
]
@ -377,6 +388,7 @@
line-height: 110px;
text-align: center;
}
.ms-point-success {
border-radius: 50%;
height: 12px;