From 3a977e134b0806d84f1510c91419a7951ec45c54 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 24 Nov 2022 16:23:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=A4=B1=E8=B4=A5=E7=94=A8?= =?UTF-8?q?=E4=BE=8BTOP10=E7=BB=9F=E8=AE=A1=E6=89=B9=E9=87=8F=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=A4=B1=E8=B4=A5=E7=9A=84=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020237 --user=宋昌昌 【测试跟踪】首页-过去7天测试计划失败用例TOP 10-失败次数没统计批量执行失败的用例 https://www.tapd.cn/55049933/s/1304585 --- .../definition/ApiDefinitionExecResultService.java | 8 ++++++-- .../metersphere/plan/service/TestPlanTestCaseService.java | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionExecResultService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionExecResultService.java index 7b9a64aaab..7347c2e387 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionExecResultService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionExecResultService.java @@ -138,8 +138,12 @@ public class ApiDefinitionExecResultService { for (RequestResult item : dto.getRequestResults()) { if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) { ApiDefinitionExecResult result = this.editResult(item, dto.getReportId(), dto.getConsole(), dto.getRunMode(), dto.getTestId(), definitionExecResultMapper); - // 批量更新关联关系状态 - batchEditStatus(dto.getRunMode(), result.getStatus(), result.getId(), dto.getTestId(), batchApiTestCaseMapper); + if (result != null) { + result.setResourceId(dto.getTestId()); + apiExecutionInfoService.insertExecutionInfo(result); + // 批量更新关联关系状态 + batchEditStatus(dto.getRunMode(), result.getStatus(), result.getId(), dto.getTestId(), batchApiTestCaseMapper); + } if (result != null && !StringUtils.startsWithAny(dto.getRunMode(), "SCHEDULE")) { User user = null; if (MapUtils.isNotEmpty(dto.getExtendedParameters()) && dto.getExtendedParameters().containsKey("user") && dto.getExtendedParameters().get("user") instanceof User) { diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java index c7acdbbbf0..67522e0bde 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java @@ -236,7 +236,13 @@ public class TestPlanTestCaseService { testPlanTestCaseMapper.updateByExampleSelective( testPlanTestCase, testPlanTestCaseExample); - + if (StringUtils.isNotBlank(testPlanTestCase.getStatus()) && + !StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) { + //记录功能用例执行信息 + request.getIds().forEach(caseId -> { + functionCaseExecutionInfoService.insertExecutionInfo(caseId, testPlanTestCase.getStatus()); + }); + } if (StringUtils.isNotBlank(request.getStatus())) { List caseIds = extTestPlanTestCaseMapper.getCaseIdsByIds(request.getIds()); testCaseService.updateLastExecuteStatus(caseIds, request.getStatus());