From 93ee0e5ac7e6af0954a6fd8fa59b81719c88e1ea Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 21 Mar 2022 20:20:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E7=BB=9F=E8=AE=A1=E4=B8=8D=E5=AF=B9=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1011419 --user=宋天阳 【接口测试】接口用例批量执行,集合报告,成功用例数统计错误 https://www.tapd.cn/55049933/s/1122786 --- .../ApiScenarioReportStructureService.java | 12 ++++++++++-- .../report/components/MetricChart.vue | 17 +++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java index a3656094d9..7cfebe054c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -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()); diff --git a/frontend/src/business/components/api/automation/report/components/MetricChart.vue b/frontend/src/business/components/api/automation/report/components/MetricChart.vue index 757b587474..aafe93a992 100644 --- a/frontend/src/business/components/api/automation/report/components/MetricChart.vue +++ b/frontend/src/business/components/api/automation/report/components/MetricChart.vue @@ -43,10 +43,10 @@ - -
+ +
-
+
{{ content.unExecute }} {{ $t('api_test.home_page.detail_card.unexecute') }}
@@ -81,8 +81,8 @@
{{ content.scenarioErrorReport ? content.scenarioErrorReport : 0 }}
{{ $t('error_report_library.option.name') }}
- -
+ +
{{ content.scenarioUnExecute ? content.scenarioUnExecute : 0 }}
{{ $t('api_test.home_page.detail_card.unexecute') }}
@@ -92,7 +92,8 @@
{{ content.scenarioStepTotal ? content.scenarioStepTotal : 0 }}
-
{{ $t('test_track.plan_view.step') }}
+
{{$t('api_test.definition.request.case')}}
+
{{ $t('test_track.plan_view.step') }}
@@ -110,8 +111,8 @@
{{ content.scenarioStepErrorReport ? content.scenarioStepErrorReport : 0 }}
{{ $t('error_report_library.option.name') }}
- -
+ +
{{ content.scenarioStepUnExecuteReport ? content.scenarioStepUnExecuteReport : 0 }}