fix(测试计划): 测试计划执行,场景中引用了场景,执行时步骤会重复执行

--bug=1050539 --user=陈建星 【测试计划】github#34649,测试计划执行时,有时候步骤会执行多次 https://www.tapd.cn/55049933/s/1632547
This commit is contained in:
AgAngle 2024-12-17 16:22:23 +08:00 committed by Craftsman
parent 0b9fc2ef3d
commit 80be2bb343
2 changed files with 1 additions and 11 deletions

View File

@ -58,7 +58,7 @@ public class PlanRunApiScenarioExecuteCallbackService implements ApiExecuteCallb
ApiScenarioDetail apiScenarioDetail = apiScenarioRunService.getForRunWithTaskItemErrorMassage(request.getTaskItem().getId(), testPlanReportApiScenario.getApiScenarioId()); ApiScenarioDetail apiScenarioDetail = apiScenarioRunService.getForRunWithTaskItemErrorMassage(request.getTaskItem().getId(), testPlanReportApiScenario.getApiScenarioId());
apiScenarioDetail.setEnvironmentId(testPlanReportApiScenario.getEnvironmentId()); apiScenarioDetail.setEnvironmentId(testPlanReportApiScenario.getEnvironmentId());
apiScenarioDetail.setGrouped(testPlanReportApiScenario.getGrouped()); apiScenarioDetail.setGrouped(testPlanReportApiScenario.getGrouped());
GetRunScriptResult result = planRunTestPlanApiScenarioService.getRunScript(request); GetRunScriptResult result = apiScenarioRunService.getRunScript(request, apiScenarioDetail);
String reportId = initReport(request, testPlanReportApiScenario, apiScenarioDetail); String reportId = initReport(request, testPlanReportApiScenario, apiScenarioDetail);
result.setReportId(reportId); result.setReportId(reportId);
return result; return result;

View File

@ -2,7 +2,6 @@ package io.metersphere.plan.service;
import io.metersphere.api.domain.ApiScenario; import io.metersphere.api.domain.ApiScenario;
import io.metersphere.api.domain.ApiScenarioReport; import io.metersphere.api.domain.ApiScenarioReport;
import io.metersphere.api.dto.scenario.ApiScenarioDetail;
import io.metersphere.api.mapper.ApiScenarioMapper; import io.metersphere.api.mapper.ApiScenarioMapper;
import io.metersphere.api.service.ApiBatchRunBaseService; import io.metersphere.api.service.ApiBatchRunBaseService;
import io.metersphere.api.service.ApiExecuteService; import io.metersphere.api.service.ApiExecuteService;
@ -201,13 +200,4 @@ public class PlanRunTestPlanApiScenarioService {
apiExecutionQueueService.deleteQueue(queue.getQueueId()); apiExecutionQueueService.deleteQueue(queue.getQueueId());
} }
} }
public GetRunScriptResult getRunScript(GetRunScriptRequest request) {
TaskItem taskItem = request.getTaskItem();
TestPlanReportApiScenario testPlanReportApiScenario = testPlanReportApiScenarioMapper.selectByPrimaryKey(taskItem.getResourceId());
ApiScenarioDetail apiScenarioDetail = apiScenarioRunService.getForRun(testPlanReportApiScenario.getApiScenarioId());
apiScenarioDetail.setEnvironmentId(testPlanReportApiScenario.getEnvironmentId());
apiScenarioDetail.setGrouped(testPlanReportApiScenario.getGrouped());
return apiScenarioRunService.getRunScript(request, apiScenarioDetail);
}
} }