From bfca50f212a1df74c7c4a06b754a9722beef46d6 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 11 Apr 2024 19:00:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E6=8A=A5=E5=91=8A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=AD=A5=E9=AA=A4=E7=8A=B6=E6=80=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1039175 --user=王孝刚 【接口测试】场景步骤存在未执行的子步骤,场景步骤为未执行 https://www.tapd.cn/55049933/s/1495103 --- .../api/service/scenario/ApiScenarioReportService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java index 759c13778e..5b7abc30e6 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java @@ -308,6 +308,8 @@ public class ApiScenarioReportService { //需要把这些数据拿出来 如果没有子请求说明是最后一级的请求 不需要计算入状态 //获取所有的子请求的状态 List requestStatus = children.stream().map(ApiScenarioReportStepDTO::getStatus).toList(); + //获取为执行的状态 + List pendingStatus = requestStatus.stream().filter(status -> StringUtils.equals(ApiReportStatus.PENDING.name(), status) || StringUtils.isBlank(status)).toList(); //过滤出来SUCCESS的状态 List successStatus = requestStatus.stream().filter(status -> StringUtils.equals(ApiReportStatus.SUCCESS.name(), status)).toList(); //只要包含ERROR 就是ERROR @@ -315,7 +317,7 @@ public class ApiScenarioReportService { step.setStatus(ApiReportStatus.ERROR.name()); } else if (requestStatus.contains(ApiReportStatus.FAKE_ERROR.name())) { step.setStatus(ApiReportStatus.FAKE_ERROR.name()); - } else if (successStatus.size() == children.size()) { + } else if (successStatus.size() + pendingStatus.size() == children.size() && !successStatus.isEmpty()) { step.setStatus(ApiReportStatus.SUCCESS.name()); } } else if (stepTypes.contains(step.getStepType())) {