fix(接口测试): 修复次数循环当条件为负数时造成死循环问题
https://github.com/metersphere/metersphere/issues/18290
This commit is contained in:
parent
db1701411a
commit
0525af0ca3
|
@ -173,7 +173,7 @@ public class MsLoopController extends MsTestElement {
|
||||||
private IfController ifController(String condition) {
|
private IfController ifController(String condition) {
|
||||||
IfController ifController = new IfController();
|
IfController ifController = new IfController();
|
||||||
ifController.setEnabled(this.isEnable());
|
ifController.setEnabled(this.isEnable());
|
||||||
ifController.setName("while ifController");
|
ifController.setName("Loop ifController");
|
||||||
ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName());
|
ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName());
|
||||||
ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel"));
|
ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel"));
|
||||||
ifController.setCondition(condition);
|
ifController.setCondition(condition);
|
||||||
|
@ -281,7 +281,9 @@ public class MsLoopController extends MsTestElement {
|
||||||
return tree.add(initForeachController());
|
return tree.add(initForeachController());
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(this.loopType, LoopConstants.LOOP_COUNT.name()) && this.countController != null) {
|
if (StringUtils.equals(this.loopType, LoopConstants.LOOP_COUNT.name()) && this.countController != null) {
|
||||||
return tree.add(initLoopController());
|
String ifCondition = StringUtils.join("${__jexl3(", countController.getLoops(), " > 0 ", ")}");
|
||||||
|
HashTree ifHashTree = tree.add(ifController(ifCondition));
|
||||||
|
return ifHashTree.add(initLoopController());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue