fix(接口测试): 修复场景变量参数值为空的时候执行报错的缺陷

--bug=1027469 --user=王孝刚 【接口测试】场景详情-场景变量值为空-未引用场景变量-调试场景报错
https://www.tapd.cn/55049933/s/1388281
This commit is contained in:
wxg0103 2023-06-29 17:06:45 +08:00 committed by fit2-zhao
parent fd72714a7b
commit 17238af777

View File

@ -738,7 +738,8 @@ public class ElementUtil {
variables.stream()
.filter(ScenarioVariable::isConstantValid).forEach(keyValue ->
arguments.addArgument(keyValue.getName(),
keyValue.getValue().replaceAll("[\r\n]",""), "="));
StringUtils.isNotBlank(keyValue.getValue())
? keyValue.getValue().replaceAll("[\r\n]","") : keyValue.getValue(), "="));
List<ScenarioVariable> variableList = variables.stream()
.filter(ScenarioVariable::isListValid).collect(Collectors.toList());
variableList.forEach(item -> {
@ -761,7 +762,9 @@ public class ElementUtil {
arguments.addArgument(keyValue.getName(),
keyValue.getValue() != null && keyValue.getValue().startsWith("@")
? ScriptEngineUtils.buildFunctionCallString(keyValue.getValue())
: keyValue.getValue().replaceAll("[\r\n]",""), "="));
: (StringUtils.isNotBlank(keyValue.getValue())
? keyValue.getValue().replaceAll("[\r\n]","")
: keyValue.getValue()), "="));
// List类型的变量
List<ScenarioVariable> variableList = config.getConfig().get(projectId).getCommonConfig().getVariables().stream()
.filter(ScenarioVariable::isListValid)