fix(接口测试): 修复集合报告无法停止问题

This commit is contained in:
fit2-zhao 2024-08-16 16:57:10 +08:00 committed by Craftsman
parent 6bffafb402
commit b26444f210
2 changed files with 12 additions and 7 deletions

View File

@ -166,7 +166,9 @@ public class ApiTestCaseBatchRunService {
}
// 如果是集成报告则生成唯一的虚拟ID非集成报告使用单用例的报告ID
String reportId = runModeConfig.isIntegratedReport() ? UUID.randomUUID().toString() : caseReportMap.get(id);
String reportId = runModeConfig.isIntegratedReport()
? runModeConfig.getCollectionReport().getReportId() + IDGenerator.nextStr()
: caseReportMap.get(id);
TaskItem taskItem = apiExecuteService.getTaskItem(reportId, id);
taskItem.setRequestCount(1L);
@ -277,7 +279,7 @@ public class ApiTestCaseBatchRunService {
String reportId;
if (runModeConfig.isIntegratedReport()) {
reportId = IDGenerator.nextStr();
reportId = runModeConfig.getCollectionReport().getReportId() + IDGenerator.nextStr();
} else {
// 独立报告执行到当前任务时初始化报告
reportId = initApiReport(runModeConfig, List.of(apiTestCase), queue.getUserId()).getFirst().getApiReportId();

View File

@ -137,10 +137,13 @@ public class ApiScenarioBatchRunService {
setRunningIntegrateReport(runModeConfig);
List<TaskItem> taskItems = ids.stream()
.map(id -> {
String reportId = runModeConfig.isIntegratedReport() ? IDGenerator.nextStr() : scenarioReportMap.get(id);
return apiExecuteService.getTaskItem(reportId, id);
}).toList();
.map(id -> apiExecuteService.getTaskItem(
runModeConfig.isIntegratedReport()
? runModeConfig.getCollectionReport().getReportId() + IDGenerator.nextStr()
: scenarioReportMap.get(id), id
))
.toList();
TaskBatchRequestDTO taskRequest = getTaskBatchRequestDTO(request.getProjectId(), runModeConfig);
taskRequest.setTaskItems(taskItems);
taskRequest.getTaskInfo().setUserId(userId);
@ -259,7 +262,7 @@ public class ApiScenarioBatchRunService {
String reportId;
if (runModeConfig.isIntegratedReport()) {
reportId = IDGenerator.nextStr();
reportId = runModeConfig.getCollectionReport().getReportId() + IDGenerator.nextStr();
} else {
// 独立报告执行到当前任务时初始化报告
reportId = initScenarioReport(runModeConfig, apiScenario, queue.getUserId()).getApiScenarioReportId();