refactor(接口测试): 场景变量机制优化,当所有优先规则不选时,默认过程变量优先

This commit is contained in:
fit2-zhao 2023-01-09 17:35:45 +08:00
parent 891547f72a
commit e7b9655e18
1 changed files with 6 additions and 1 deletions

View File

@ -162,7 +162,7 @@ public class MsScenario extends MsTestElement {
// 这里加入自定义变量解决ForEach循环控制器取值问题循环控制器无法从vars中取值
if (BooleanUtils.isTrue(this.variableEnable) || BooleanUtils.isTrue(this.mixEnable)) {
scenarioTree.add(ElementUtil.argumentsToUserParameters(valueSupposeMock));
} else if (config != null && (StringUtils.equals(this.getId(), config.getScenarioId()) || config.isApi())) {
} else if (config != null && (this.isAllEnable() || config.isApi())) {
scenarioTree.add(valueSupposeMock);
}
}
@ -202,6 +202,11 @@ public class MsScenario extends MsTestElement {
this.setGlobProcessor(this.isEnvironmentEnable() ? newConfig : config, scenarioTree, false);
}
private boolean isAllEnable() {
return (this.variableEnable == null || BooleanUtils.isFalse(this.variableEnable))
&& (this.mixEnable == null || BooleanUtils.isFalse(this.mixEnable));
}
private void setGlobProcessor(ParameterConfig config, HashTree scenarioTree, boolean isPre) {
if (config.getConfig() != null && (this.variableEnable == null || this.variableEnable)) {
config.getConfig().forEach((k, environmentConfig) -> {