fix(测试计划): 资源池运行场景环境问题

--bug=1008256 --user=lyh 【测试计划】-并行、k8s资源池执行场景用例-选择环境组的不生效
https://www.tapd.cn/55049933/s/1074099
This commit is contained in:
shiziyuan9527 2021-11-24 15:29:12 +08:00 committed by shiziyuan9527
parent 57c49ad596
commit ea52fe185c
1 changed files with 11 additions and 9 deletions

View File

@ -61,7 +61,7 @@ public class ApiJmeterFileService {
if (StringUtils.isNotEmpty(testPlanScenarioId)) {
// 获取场景用例单独的执行环境
TestPlanApiScenario planApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(testPlanScenarioId);
if(planApiScenario != null){
if (planApiScenario != null) {
String envType = planApiScenario.getEnvironmentType();
String environmentGroupId = planApiScenario.getEnvironmentGroupId();
String environment = planApiScenario.getEnvironment();
@ -75,7 +75,7 @@ public class ApiJmeterFileService {
HashTree hashTree;
if (ApiRunMode.DEFINITION.name().equals(runMode) || ApiRunMode.API_PLAN.name().equals(runMode) || ApiRunMode.MANUAL_PLAN.name().equals(runMode)) {
String testId = remoteTestId;
if(remoteTestId.contains(":")){
if (remoteTestId.contains(":")) {
//执行测试计划案例时会有拼接ID,ID为 planTestCaseId:测试计划报告ID
testId = remoteTestId.split(":")[0];
}
@ -85,13 +85,15 @@ public class ApiJmeterFileService {
if (item == null) {
MSException.throwException("未找到执行场景。");
}
String envType = item.getEnvironmentType();
String envJson = item.getEnvironmentJson();
String envGroupId = item.getEnvironmentGroupId();
if (StringUtils.equals(envType, EnvironmentType.JSON.name()) && StringUtils.isNotBlank(envJson)) {
planEnvMap = JSON.parseObject(envJson, Map.class);
} else if (StringUtils.equals(envType, EnvironmentType.GROUP.name()) && StringUtils.isNotBlank(envGroupId)) {
planEnvMap = environmentGroupProjectService.getEnvMap(envGroupId);
if (StringUtils.isBlank(testPlanScenarioId)) {
String envType = item.getEnvironmentType();
String envJson = item.getEnvironmentJson();
String envGroupId = item.getEnvironmentGroupId();
if (StringUtils.equals(envType, EnvironmentType.JSON.name()) && StringUtils.isNotBlank(envJson)) {
planEnvMap = JSON.parseObject(envJson, Map.class);
} else if (StringUtils.equals(envType, EnvironmentType.GROUP.name()) && StringUtils.isNotBlank(envGroupId)) {
planEnvMap = environmentGroupProjectService.getEnvMap(envGroupId);
}
}
hashTree = apiAutomationService.generateHashTree(item, reportId, planEnvMap);
}