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());