fix(接口测试): 测试计划执行异常数据处理
This commit is contained in:
parent
c0a96dfc9d
commit
837ee824d3
|
@ -119,7 +119,8 @@ public class ApiScenarioExecuteService {
|
||||||
LoggerUtil.info("Scenario run-执行脚本装载-开始针对所有执行场景进行环境检查");
|
LoggerUtil.info("Scenario run-执行脚本装载-开始针对所有执行场景进行环境检查");
|
||||||
apiScenarioEnvService.checkEnv(request, apiScenarios);
|
apiScenarioEnvService.checkEnv(request, apiScenarios);
|
||||||
// 集合报告设置
|
// 集合报告设置
|
||||||
if (request.getConfig() != null && StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString()) && StringUtils.isNotEmpty(request.getConfig().getReportName())) {
|
if (request.getConfig() != null && StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString())
|
||||||
|
&& StringUtils.isNotEmpty(request.getConfig().getReportName())) {
|
||||||
if (request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
|
if (request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
|
||||||
request.setExecuteType(ExecuteType.Completed.name());
|
request.setExecuteType(ExecuteType.Completed.name());
|
||||||
} else {
|
} else {
|
||||||
|
@ -159,7 +160,8 @@ public class ApiScenarioExecuteService {
|
||||||
responseDTOS.add(new MsExecResponseDTO(JSON.toJSONString(scenarioIds), serialReportId, request.getRunMode()));
|
responseDTOS.add(new MsExecResponseDTO(JSON.toJSONString(scenarioIds), serialReportId, request.getRunMode()));
|
||||||
// 增加并行集合报告
|
// 增加并行集合报告
|
||||||
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.PARALLEL.toString())) {
|
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.PARALLEL.toString())) {
|
||||||
apiScenarioReportStructureService.save(apiScenarios, serialReportId, request.getConfig() != null ? request.getConfig().getReportType() : null);
|
apiScenarioReportStructureService.save(apiScenarios, serialReportId, request.getConfig() != null
|
||||||
|
? request.getConfig().getReportType() : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 开始执行
|
// 开始执行
|
||||||
|
@ -278,16 +280,12 @@ public class ApiScenarioExecuteService {
|
||||||
executeQueue.put(report.getId(), runModeDataDTO);
|
executeQueue.put(report.getId(), runModeDataDTO);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
scenarioIds.remove(scenario.getId());
|
scenarioIds.remove(scenario.getId());
|
||||||
if (StringUtils.equalsAny(request.getTriggerMode(), TriggerMode.BATCH.name(), TriggerMode.SCHEDULE.name())) {
|
executeQueue.remove(report.getId());
|
||||||
remakeReportService.remakeScenario(request.getRunMode(), testPlanScenarioId, scenario, report);
|
remakeReportService.remakeScenario(request.getRunMode(), testPlanScenarioId, scenario, report);
|
||||||
} else {
|
continue;
|
||||||
MSException.throwException(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarioNames.append(scenario.getName()).append(",");
|
scenarioNames.append(scenario.getName()).append(",");
|
||||||
|
|
||||||
// 生成文档结构
|
// 生成文档结构
|
||||||
if (request.getConfig() == null || !StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString())) {
|
if (request.getConfig() == null || !StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString())) {
|
||||||
apiScenarioReportStructureService.save(scenario, report.getId(), request.getConfig() != null ? request.getConfig().getReportType() : null);
|
apiScenarioReportStructureService.save(scenario, report.getId(), request.getConfig() != null ? request.getConfig().getReportType() : null);
|
||||||
|
@ -323,8 +321,8 @@ public class ApiScenarioExecuteService {
|
||||||
runModeDataDTO.setReportId(report.getId());
|
runModeDataDTO.setReportId(report.getId());
|
||||||
executeQueue.put(report.getId(), runModeDataDTO);
|
executeQueue.put(report.getId(), runModeDataDTO);
|
||||||
} else {
|
} else {
|
||||||
// 生成报告和HashTree
|
|
||||||
try {
|
try {
|
||||||
|
// 生成报告和HashTree
|
||||||
RunModeDataDTO runModeDataDTO = new RunModeDataDTO(report, item.getId());
|
RunModeDataDTO runModeDataDTO = new RunModeDataDTO(report, item.getId());
|
||||||
if (request.getConfig() != null && !request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
|
if (request.getConfig() != null && !request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
|
||||||
HashTree hashTree = GenerateHashTreeUtil.generateHashTree(item, StringUtils.isNotEmpty(serialReportId) ? serialReportId + "-" + i : reportId, request.getConfig().getEnvMap(), request.getConfig().getReportType());
|
HashTree hashTree = GenerateHashTreeUtil.generateHashTree(item, StringUtils.isNotEmpty(serialReportId) ? serialReportId + "-" + i : reportId, request.getConfig().getEnvMap(), request.getConfig().getReportType());
|
||||||
|
|
|
@ -143,6 +143,6 @@ public class RemakeReportService {
|
||||||
apiScenarioMapper.updateByPrimaryKey(scenarioWithBLOBs);
|
apiScenarioMapper.updateByPrimaryKey(scenarioWithBLOBs);
|
||||||
}
|
}
|
||||||
report.setStatus(APITestStatus.Error.name());
|
report.setStatus(APITestStatus.Error.name());
|
||||||
apiScenarioReportMapper.insert(report);
|
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue