From 9e6d3637fdc15b75bfe49de5cd5c368a96d888a9 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Sat, 22 Jan 2022 13:33:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=AF=AF=E6=8A=A5=E5=BA=93):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=9C=BA=E6=99=AF=E6=8A=A5=E5=91=8A=E5=9C=A8=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E8=AF=AF=E6=8A=A5=E5=BA=93=E4=B9=8B=E5=90=8E=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复场景报告在启用误报库之后统计错误的问题 --- .../ApiScenarioReportStructureService.java | 22 ++++++++++--------- .../components/case/ApiCaseItem.vue | 1 + frontend/src/business/components/xpack | 2 +- 3 files changed, 14 insertions(+), 11 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 95c91d1468..ea51280cdd 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -141,21 +141,24 @@ public class ApiScenarioReportStructureService { } private void scenarioCalculate(List dtoList, AtomicLong isError, AtomicLong isErrorReport) { + /** + * 判断场景步骤的执行状态 + * 失败状态的优先级最高,其次是误报 + */ for (StepTreeDTO step : dtoList) { if (step.getValue() != null) { - if (StringUtils.isNotEmpty(step.getErrorCode())) { - isErrorReport.set(isErrorReport.longValue() + 1); - } else if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) { + if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) { isError.set(isError.longValue() + 1); + } else if (StringUtils.isNotEmpty(step.getErrorCode())) { + isErrorReport.set(isErrorReport.longValue() + 1); } } else if (CollectionUtils.isNotEmpty(step.getChildren())) { AtomicLong isChildrenError = new AtomicLong(); AtomicLong isChildrenErrorReport = new AtomicLong(); - stepChildrenErrorCalculate(step.getChildren(), isChildrenError,isChildrenErrorReport); + stepChildrenErrorCalculate(step.getChildren(), isChildrenError, isChildrenErrorReport); if (isChildrenError.longValue() > 0) { isError.set(isError.longValue() + 1); - } - if(isChildrenErrorReport.longValue() > 0){ + } else if (isChildrenErrorReport.longValue() > 0) { isErrorReport.set(isErrorReport.longValue() + 1); } } @@ -309,12 +312,11 @@ public class ApiScenarioReportStructureService { private void stepChildrenErrorCalculate(List dtoList, AtomicLong isError, AtomicLong isErrorReport) { for (StepTreeDTO step : dtoList) { if (step.getValue() != null && step.getValue().getError() > 0) { - if (StringUtils.isNotEmpty(step.getErrorCode())) { - isErrorReport.set(isErrorReport.longValue() + 1); - } else if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) { + if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) { isError.set(isError.longValue() + 1); + } else if (StringUtils.isNotEmpty(step.getErrorCode())) { + isErrorReport.set(isErrorReport.longValue() + 1); } - break; } else if (CollectionUtils.isNotEmpty(step.getChildren())) { stepChildrenErrorCalculate(step.getChildren(), isError, isErrorReport); } diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 8aa4e7bf07..2f941f7c46 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -203,6 +203,7 @@ export default { resultMap: new Map([ ['success', this.$t('test_track.plan_view.execute_result') + ':' + this.$t('test_track.plan_view.pass')], ['error', this.$t('test_track.plan_view.execute_result') + ':' + this.$t('api_test.home_page.detail_card.execution_failed')], + ['errorReportResult', this.$t('test_track.plan_view.execute_result') + ':' + this.$t('error_report_library.option.name')], ['default', this.$t('test_track.plan_view.execute_result') + ':' + this.$t('api_test.home_page.detail_card.unexecute')] ]), isXpack: false, diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index b8d7a91300..fc88eec584 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit b8d7a91300b411662a3492b08a7ec88b29a05c3d +Subproject commit fc88eec58494a51c04dbc39ee1c7b956f1e16a12