fix(测试计划): 修复测试计划执行导入的未选择环境的场景时,校验逻辑判断出错最终导致计划无法正常结束的问题
--bug=1029266 --user=宋天阳 【测试跟踪】执行计划-报告列表查看-状态仍显示为Running https://www.tapd.cn/55049933/s/1407134
This commit is contained in:
parent
71784c3218
commit
a4291470d0
|
@ -112,9 +112,9 @@ public class ApiJMeterFileService {
|
|||
|
||||
private Map<String, String> extractScenarioEnv(String envType, String envJson, String envGroupId) {
|
||||
Map<String, String> scenarioEnv = new LinkedHashMap<>();
|
||||
if (envType.equals(EnvironmentType.JSON.name()) && !envJson.isBlank()) {
|
||||
if (envType.equals(EnvironmentType.JSON.name()) && StringUtils.isNotBlank(envJson)) {
|
||||
scenarioEnv = JSON.parseObject(envJson, Map.class);
|
||||
} else if (envType.equals(EnvironmentType.GROUP.name()) && !envGroupId.isBlank()) {
|
||||
} else if (envType.equals(EnvironmentType.GROUP.name()) && StringUtils.isNotBlank(envGroupId)) {
|
||||
scenarioEnv = environmentGroupProjectService.getEnvMap(envGroupId);
|
||||
}
|
||||
return scenarioEnv;
|
||||
|
|
|
@ -861,9 +861,9 @@ public class ApiScenarioReportService {
|
|||
|
||||
private Map<String, String> extractScenarioEnv(String envType, String envJson, String envGroupId) {
|
||||
Map<String, String> scenarioEnv = new LinkedHashMap<>();
|
||||
if (envType.equals(EnvironmentType.JSON.name()) && !envJson.isBlank()) {
|
||||
if (envType.equals(EnvironmentType.JSON.name()) && StringUtils.isNotBlank(envJson)) {
|
||||
scenarioEnv = JSON.parseObject(envJson, Map.class);
|
||||
} else if (envType.equals(EnvironmentType.GROUP.name()) && !envGroupId.isBlank()) {
|
||||
} else if (envType.equals(EnvironmentType.GROUP.name()) && StringUtils.isNotBlank(envGroupId)) {
|
||||
scenarioEnv = environmentGroupProjectService.getEnvMap(envGroupId);
|
||||
}
|
||||
return scenarioEnv;
|
||||
|
|
|
@ -175,10 +175,15 @@ public class TestPlanExecuteService {
|
|||
for (TestPlanApiDTO dto : apiTestCases) {
|
||||
dto.setReportId(apiCaseReportMap.get(dto.getId()));
|
||||
}
|
||||
} else {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.API_CASE.name(), testPlanReportId);
|
||||
executing = false;
|
||||
apiTestCases.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.API_CASE.name(), testPlanReportId);
|
||||
apiTestCases = null;
|
||||
executing = false;
|
||||
LoggerUtil.info("测试报告" + testPlanReportId + "本次执行测试计划接口用例失败! ", e);
|
||||
}
|
||||
}
|
||||
|
@ -217,10 +222,16 @@ public class TestPlanExecuteService {
|
|||
if (CollectionUtils.isNotEmpty(removeDTO)) {
|
||||
scenarioCases.removeAll(removeDTO);
|
||||
}
|
||||
} else {
|
||||
//如果没有执行的用例,解锁数据,并设置执行数据为空
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.SCENARIO.name(), testPlanReportId);
|
||||
executing = false;
|
||||
scenarioCases.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.SCENARIO.name(), testPlanReportId);
|
||||
scenarioCases = null;
|
||||
executing = false;
|
||||
LoggerUtil.info("测试报告" + testPlanReportId + "本次执行测试计划场景用例失败! ", e);
|
||||
}
|
||||
}
|
||||
|
@ -249,10 +260,15 @@ public class TestPlanExecuteService {
|
|||
for (TestPlanUiScenarioDTO dto : uiScenarios) {
|
||||
dto.setReportId(uiScenarioReportMap.get(dto.getId()));
|
||||
}
|
||||
} else {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.UI_SCENARIO.name(), testPlanReportId);
|
||||
uiScenarios.clear();
|
||||
executing = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.UI_SCENARIO.name(), testPlanReportId);
|
||||
uiScenarios = null;
|
||||
executing = false;
|
||||
LoggerUtil.info("测试报告" + testPlanReportId + "本次执行测试计划 UI 用例失败! ", e);
|
||||
}
|
||||
}
|
||||
|
@ -273,8 +289,12 @@ public class TestPlanExecuteService {
|
|||
loadCaseReportMap = perfExecService.executeLoadCase(testPlanReportId, runModeConfig, testPlanService.transformationPerfTriggerMode(triggerMode), executeCase);
|
||||
if (MapUtils.isNotEmpty(loadCaseReportMap)) {
|
||||
executing = true;
|
||||
} else {
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.LOAD_CASE.name(), testPlanReportId);
|
||||
executing = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
executing = false;
|
||||
redisTemplateService.unlock(testPlanReportId, TestPlanExecuteCaseType.LOAD_CASE.name(), testPlanReportId);
|
||||
LoggerUtil.info("测试报告" + testPlanReportId + "本次执行测试计划性能用例失败! ", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue