fix(接口测试): 修复场景变量不选任何策略时,默认执行取参错误问题

--bug=1020890 --user=赵勇 【接口测试】场景引用其他场景,场景设置中都不勾选,变量引用了原场景变量 https://www.tapd.cn/55049933/s/1316024
This commit is contained in:
fit2-zhao 2022-12-15 18:24:01 +08:00
parent 07d3deba71
commit b2dc1a6cd9
1 changed files with 4 additions and 5 deletions

View File

@ -157,17 +157,16 @@ public class MsScenario extends MsTestElement {
// 环境变量
Arguments arguments = arguments(this.isEnvironmentEnable() ? newConfig : config);
if (arguments != null && ((this.variableEnable == null || this.variableEnable)
|| (this.mixEnable == null || this.mixEnable))) {
if (arguments != null && !arguments.getArguments().isEmpty()) {
Arguments valueSupposeMock = ParameterConfig.valueSupposeMock(arguments);
// 这里加入自定义变量解决ForEach循环控制器取值问题循环控制器无法从vars中取值
if ((this.variableEnable == null || this.variableEnable) || (this.mixEnable == null || this.mixEnable)) {
if (BooleanUtils.isTrue(this.variableEnable) || BooleanUtils.isTrue(this.mixEnable)) {
scenarioTree.add(ElementUtil.argumentsToUserParameters(valueSupposeMock));
} else {
} else if (config != null && StringUtils.equals(this.getId(), config.getScenarioId())) {
scenarioTree.add(valueSupposeMock);
}
}
if (this.variableEnable == null || this.variableEnable) {
if (this.variableEnable == null || this.variableEnable || BooleanUtils.isTrue(this.mixEnable)) {
ElementUtil.addCsvDataSet(scenarioTree, variables, this.isEnvironmentEnable() ? newConfig : config, "shareMode.group");
ElementUtil.addCounter(scenarioTree, variables, false);
ElementUtil.addRandom(scenarioTree, variables);