fix(接口测试): 修复计数器含变量执行失败问题
--bug=1020852 --user=赵勇 【接口测试】场景变量中有计数器变量时,执行失败 https://www.tapd.cn/55049933/s/1315579
This commit is contained in:
parent
0d79032257
commit
f7db4dbadc
|
@ -227,11 +227,14 @@ public class ParameterConfig extends MsParameter {
|
|||
|
||||
public void margeVariables(List<ScenarioVariable> variables, List<ScenarioVariable> transferVariables) {
|
||||
if (CollectionUtils.isNotEmpty(transferVariables)) {
|
||||
List<ScenarioVariable> constants = variables.stream().filter(ScenarioVariable::isConstantValid).collect(Collectors.toList());
|
||||
Map<String, List<ScenarioVariable>> transferVariableGroup =
|
||||
transferVariables.stream().collect(Collectors.groupingBy(ScenarioVariable::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
Map<String, List<ScenarioVariable>> constantsGroup =
|
||||
constants.stream().collect(Collectors.groupingBy(ScenarioVariable::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
List<ScenarioVariable> constants = variables.stream()
|
||||
.filter(ScenarioVariable::isConstantValid).collect(Collectors.toList());
|
||||
|
||||
Map<String, List<ScenarioVariable>> transferVariableGroup = transferVariables.stream()
|
||||
.collect(Collectors.groupingBy(ScenarioVariable::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
Map<String, List<ScenarioVariable>> constantsGroup = constants.stream()
|
||||
.collect(Collectors.groupingBy(ScenarioVariable::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
// 更新相同名称的值
|
||||
for (ScenarioVariable constant : constants) {
|
||||
if (transferVariableGroup.containsKey(constant.getName())
|
||||
|
@ -240,7 +243,9 @@ public class ParameterConfig extends MsParameter {
|
|||
}
|
||||
}
|
||||
// 添加当前没有的值
|
||||
transferVariables.forEach(item -> {
|
||||
List<ScenarioVariable> transferConstants = transferVariables.stream()
|
||||
.filter(ScenarioVariable::isConstantValid).collect(Collectors.toList());
|
||||
transferConstants.forEach(item -> {
|
||||
if (!constantsGroup.containsKey(item.getName())) {
|
||||
variables.add(item);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue