fix(接口测试): 批量执行失败
This commit is contained in:
parent
104f5406ae
commit
74dba73597
|
@ -132,14 +132,8 @@ public class ApiScenarioBatchRunService {
|
|||
initIntegratedReportCaseRecord(reportId, subIds);
|
||||
// 集合报告初始化一级步骤
|
||||
initApiScenarioReportStep(apiScenarios, reportId);
|
||||
} else {
|
||||
// 初始化任务项
|
||||
Map<String, String> resourceExecTaskItemMap = execTaskItems
|
||||
.stream()
|
||||
.collect(Collectors.toMap(ExecTaskItem::getResourceId, ExecTaskItem::getId));
|
||||
// 非集合报告,初始化独立报告,执行时初始化步骤
|
||||
initScenarioReport(resourceExecTaskItemMap, runModeConfig, apiScenarios, userId);
|
||||
}
|
||||
|
||||
// 初始化队列项
|
||||
apiBatchRunBaseService.initExecutionQueueDetails(queue.getQueueId(), execTaskItems);
|
||||
});
|
||||
|
|
|
@ -207,7 +207,7 @@ public class PlanRunTestPlanApiCaseService {
|
|||
ApiTestCase apiTestCase = apiTestCaseMapper.selectByPrimaryKey(testPlanReportApiCase.getApiCaseId());
|
||||
|
||||
// 独立报告,执行到当前任务时初始化报告
|
||||
String reportId = initApiReport(Map.of(apiTestCase.getId(), queueDetail.getTaskItemId()), runModeConfig, List.of(testPlanReportApiCase), Map.of(apiTestCase.getId(), apiTestCase), queue.getUserId()).get(resourceId);
|
||||
String reportId = initApiReport(Map.of(testPlanReportApiCase.getId(), queueDetail.getTaskItemId()), runModeConfig, List.of(testPlanReportApiCase), Map.of(apiTestCase.getId(), apiTestCase), queue.getUserId()).get(resourceId);
|
||||
TaskRequestDTO taskRequest = testPlanApiCaseBatchRunService.getTaskRequestDTO(reportId, testPlanReportApiCase.getId(), apiTestCase, runModeConfig);
|
||||
taskRequest.getTaskInfo().setTaskId(queue.getTaskId());
|
||||
taskRequest.getTaskInfo().setResourceType(ApiExecuteResourceType.PLAN_RUN_API_CASE.name());
|
||||
|
@ -256,7 +256,7 @@ public class PlanRunTestPlanApiCaseService {
|
|||
// 创建报告和任务的关联关系
|
||||
ApiReportRelateTask apiReportRelateTask = new ApiReportRelateTask();
|
||||
apiReportRelateTask.setReportId(apiReport.getId());
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(apiReport.getId()));
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(testPlanReportApiCase.getId()));
|
||||
apiReportRelateTasks.add(apiReportRelateTask);
|
||||
}
|
||||
apiReportService.insertApiReport(apiReports, apiTestCaseRecords, apiReportRelateTasks);
|
||||
|
|
|
@ -202,7 +202,7 @@ public class PlanRunTestPlanApiScenarioService {
|
|||
// 创建报告和任务的关联关系
|
||||
ApiReportRelateTask apiReportRelateTask = new ApiReportRelateTask();
|
||||
apiReportRelateTask.setReportId(apiScenario.getId());
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(apiScenario.getId()));
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(testPlanReportApiScenario.getId()));
|
||||
apiReportRelateTasks.add(apiReportRelateTask);
|
||||
}
|
||||
apiScenarioReportService.insertApiScenarioReport(apiScenarioReports, apiScenarioRecords, apiReportRelateTasks);
|
||||
|
|
|
@ -400,7 +400,7 @@ public class TestPlanApiCaseBatchRunService {
|
|||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(testPlanId);
|
||||
|
||||
// 独立报告,执行到当前任务时初始化报告
|
||||
String reportId = initApiReport(Map.of(apiTestCase.getId(), queueDetail.getTaskItemId()), runModeConfig, List.of(BeanUtils.copyBean(new TestPlanApiCaseBatchRunDTO(), testPlanApiCase)),
|
||||
String reportId = initApiReport(Map.of(testPlanApiCase.getId(), queueDetail.getTaskItemId()), runModeConfig, List.of(BeanUtils.copyBean(new TestPlanApiCaseBatchRunDTO(), testPlanApiCase)),
|
||||
testPlan.getProjectId(), queue.getUserId()).get(testPlanApiCase.getId());
|
||||
TaskRequestDTO taskRequest = getTaskRequestDTO(reportId, testPlanApiCase.getId(), apiTestCase, runModeConfig);
|
||||
taskRequest.getTaskInfo().setTaskId(queue.getTaskId());
|
||||
|
@ -464,7 +464,7 @@ public class TestPlanApiCaseBatchRunService {
|
|||
// 创建报告和任务的关联关系
|
||||
ApiReportRelateTask apiReportRelateTask = new ApiReportRelateTask();
|
||||
apiReportRelateTask.setReportId(apiReport.getId());
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(apiReport.getId()));
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(testPlanApiCase.getId()));
|
||||
apiReportRelateTasks.add(apiReportRelateTask);
|
||||
}
|
||||
apiReportService.insertApiReport(apiReports, apiTestCaseRecords, apiReportRelateTasks);
|
||||
|
|
|
@ -308,7 +308,7 @@ public class TestPlanApiScenarioBatchRunService {
|
|||
private ExecTask initExecTask(int caseSize, Project project, String userId) {
|
||||
ExecTask execTask = apiCommonService.newExecTask(project.getId(), userId);
|
||||
execTask.setCaseCount(Long.valueOf(caseSize));
|
||||
execTask.setTaskName(Translator.get("api_batch_task_name"));
|
||||
execTask.setTaskName(Translator.get("api_scenario_batch_task_name"));
|
||||
execTask.setOrganizationId(project.getOrganizationId());
|
||||
execTask.setTriggerMode(TaskTriggerMode.MANUAL.name());
|
||||
execTask.setTaskType(ExecTaskType.TEST_PLAN_API_SCENARIO.name());
|
||||
|
@ -350,7 +350,7 @@ public class TestPlanApiScenarioBatchRunService {
|
|||
// 创建报告和任务的关联关系
|
||||
ApiReportRelateTask apiReportRelateTask = new ApiReportRelateTask();
|
||||
apiReportRelateTask.setReportId(apiScenarioReport.getId());
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(apiScenarioReport.getId()));
|
||||
apiReportRelateTask.setTaskResourceId(resourceExecTaskItemMap.get(testPlanApiScenario.getId()));
|
||||
apiReportRelateTasks.add(apiReportRelateTask);
|
||||
}
|
||||
apiScenarioReportService.insertApiScenarioReport(apiScenarioReports, apiScenarioRecords, apiReportRelateTasks);
|
||||
|
|
|
@ -675,7 +675,7 @@ public class TestPlanExecuteService {
|
|||
|
||||
public void finishTaskAndSummaryTestPlanReport(String taskId, String reportId, boolean isGroupReport, boolean isStop) {
|
||||
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(reportId);
|
||||
if (StringUtils.isBlank(testPlanReport.getParentId()) && StringUtils.isNotBlank(taskId)) {
|
||||
if (StringUtils.equals(testPlanReport.getParentId(), reportId) && StringUtils.isNotBlank(taskId)) {
|
||||
// 执行完成,更新任务状态
|
||||
apiBatchRunBaseService.updateTaskStatus(taskId);
|
||||
apiBatchRunBaseService.removeRunningTaskCache(taskId);
|
||||
|
|
Loading…
Reference in New Issue