From 66c0ccfbb6b727bd33fa9bc1a82d7783a26b866d Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Sun, 25 Jun 2023 16:34:28 +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=E7=AD=89=E5=BE=85=E6=97=B6=E9=97=B4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=9C=A8=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1027292 --user=王孝刚 【接口测试】场景列表-生成报告-步骤统计-等待控制器统计到了未执行中 https://www.tapd.cn/55049933/s/1385447 --- .../controller/definition/ApiDefinitionController.java | 2 +- .../controller/definition/ApiTestCaseController.java | 2 +- .../scenario/ApiScenarioReportStructureService.java | 8 +++++--- .../business/definition/components/case/ApiCaseHeader.vue | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java index ca7a61481b..e9ace1f08b 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java @@ -108,7 +108,7 @@ public class ApiDefinitionController { @PostMapping(value = "/create", consumes = {"multipart/form-data"}) - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API) + @RequiresPermissions(value= {PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API, PermissionConstants.PROJECT_API_DEFINITION_READ_COPY_API}, logical = Logical.OR) @MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class) @SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CREATE, subject = "接口定义通知") public ApiDefinitionResult create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List bodyFiles) { diff --git a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java index fb08a98f02..a3d891de5c 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java @@ -115,7 +115,7 @@ public class ApiTestCaseController { } @PostMapping(value = "/create", consumes = {"multipart/form-data"}) - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_CASE) + @RequiresPermissions(value= {PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_CASE, PermissionConstants.PROJECT_API_DEFINITION_READ_COPY_CASE}, logical = Logical.OR) @MsAuditLog(module = OperLogModule.API_DEFINITION_CASE, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class) @SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_CREATE, subject = "接口用例通知") public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List bodyFiles) { diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java index ee171a534c..fc00fb0d94 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java @@ -45,8 +45,10 @@ public class ApiScenarioReportStructureService { ElementConstants.ABS_SAMPLER ); private static final List CONTROLS = Arrays.asList( + ElementConstants.IF_CONTROLLER + ); + private static final List CONTROL = Arrays.asList( ElementConstants.ASSERTIONS, - ElementConstants.IF_CONTROLLER, ElementConstants.CONSTANT_TIMER ); private static final String RESOURCE_ID = ElementConstants.RESOURCE_ID; @@ -262,7 +264,7 @@ public class ApiScenarioReportStructureService { stepError.set(stepError.longValue() + 1); } else if (StringUtils.equalsAnyIgnoreCase(step.getTotalStatus(), ERROR_CODE, ApiReportStatus.FAKE_ERROR.name())) { stepErrorCode.set(stepErrorCode.longValue() + 1); - } else if (!StringUtils.equalsIgnoreCase(step.getTotalStatus(), ApiReportStatus.SUCCESS.name())) { + } else if (!StringUtils.equalsIgnoreCase(step.getTotalStatus(), ApiReportStatus.SUCCESS.name()) && !CONTROL.contains(step.getType())) { stepUnExecute.set(stepUnExecute.longValue() + 1); unExecSize++; } @@ -378,7 +380,7 @@ public class ApiScenarioReportStructureService { } } } - if (StringUtils.isEmpty(dto.getTotalStatus())) { + if (StringUtils.isEmpty(dto.getTotalStatus()) && !CONTROL.contains(dto.getType())) { dto.setTotalStatus(ApiReportStatus.PENDING.name()); } else if (StringUtils.equalsAnyIgnoreCase(dto.getTotalStatus(), ApiReportStatus.ERROR.name())) { dto.setTotalStatus(ApiReportStatus.ERROR.name()); diff --git a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue index 3e624e20a9..69cec9a0fa 100644 --- a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue +++ b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue @@ -44,7 +44,10 @@