fix(接口测试): 兼容导入数据没有环境资源池无法执行问题

--bug=1021399 --user=赵勇 【接口测试】有一个场景,使用LOCAL资源池执行一直pending https://www.tapd.cn/55049933/s/1321056
This commit is contained in:
fit2-zhao 2022-12-29 18:31:32 +08:00 committed by fit2-zhao
parent 3d80530beb
commit e54f206eee
1 changed files with 3 additions and 2 deletions

View File

@ -94,10 +94,11 @@ public class GenerateHashTreeUtil {
String environmentType = apiScenarioWithBLOBs.getEnvironmentType();
String environmentJson = apiScenarioWithBLOBs.getEnvironmentJson();
String environmentGroupId = apiScenarioWithBLOBs.getEnvironmentGroupId();
if (StringUtils.isBlank(environmentType)) {
environmentType = EnvironmentType.JSON.toString();
}
if (StringUtils.equals(environmentType, EnvironmentType.JSON.toString())) {
if (StringUtils.equals(environmentType, EnvironmentType.JSON.toString()) && StringUtils.isNotBlank(environmentJson)) {
scenario.setEnvironmentMap(JSON.parseObject(environmentJson, Map.class));
} else if (StringUtils.equals(environmentType, EnvironmentType.GROUP.toString())) {
Map<String, String> map = CommonBeanFactory.getBean(BaseEnvGroupProjectService.class).getEnvMap(environmentGroupId);
@ -133,7 +134,7 @@ public class GenerateHashTreeUtil {
String definition = element.toString();
MsScenario scenario = JSON.parseObject(definition, MsScenario.class);
group.setOnSampleError(scenario.getOnSampleError());
if (planEnvMap != null && planEnvMap.size() > 0) {
if (MapUtils.isNotEmpty(planEnvMap)) {
scenario.setEnvironmentMap(planEnvMap);
} else {
setScenarioEnv(scenario, item);