mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(接口测试): 修复While循环内计数器多计数一次的问题
【while循环控制器,当变量小于判断条件时,也会执行】https://www.tapd.cn/33805590/bugtrace/bugs/view?bug_id=1133805590001008502
This commit is contained in:
parent
cd350e217e
commit
adc73158fa
@ -111,7 +111,7 @@ public class ElementUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCounter(HashTree tree, List<ScenarioVariable> variables) {
|
||||
public static void addCounter(HashTree tree, List<ScenarioVariable> variables, boolean isInternal) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
List<ScenarioVariable> list = variables.stream().filter(ScenarioVariable::isCounterValid).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
@ -121,7 +121,11 @@ public class ElementUtil {
|
||||
counterConfig.setProperty(TestElement.TEST_CLASS, CounterConfig.class.getName());
|
||||
counterConfig.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("CounterConfigGui"));
|
||||
counterConfig.setName(item.getName());
|
||||
counterConfig.setStart(item.getStartNumber());
|
||||
if (isInternal) {
|
||||
counterConfig.setStart((item.getStartNumber() + 1));
|
||||
} else {
|
||||
counterConfig.setStart(item.getStartNumber());
|
||||
}
|
||||
counterConfig.setEnd(item.getEndNumber());
|
||||
counterConfig.setVarName(item.getName());
|
||||
counterConfig.setIncrement(item.getIncrement());
|
||||
|
@ -162,7 +162,7 @@ public class MsScenario extends MsTestElement {
|
||||
tree.add(ParameterConfig.valueSupposeMock(arguments));
|
||||
}
|
||||
ElementUtil.addCsvDataSet(tree, variables, config, "shareMode.group");
|
||||
ElementUtil.addCounter(tree, variables);
|
||||
ElementUtil.addCounter(tree, variables, false);
|
||||
ElementUtil.addRandom(tree, variables);
|
||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||
config.setHeaders(this.headers);
|
||||
|
@ -60,7 +60,7 @@ public class MsLoopController extends MsTestElement {
|
||||
final HashTree groupTree = controller(tree);
|
||||
if (CollectionUtils.isNotEmpty(config.getVariables())) {
|
||||
ElementUtil.addCsvDataSet(groupTree, config.getVariables(), config, "shareMode.thread");
|
||||
ElementUtil.addCounter(groupTree, config.getVariables());
|
||||
ElementUtil.addCounter(groupTree, config.getVariables(), true);
|
||||
ElementUtil.addRandom(groupTree, config.getVariables());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user