groovy - SoapUI - 来自 groovy 的控制流
问题描述
在我的 groovy 脚本中,我有一个循环,我想执行测试步骤“MyTestStep”以运行两次:
for (i = 0; i < 3; i++) {
testRunner.runTestStepByName("MyTestStep2")
}
当我运行 groovy 脚本时工作正常 - 但是当我启动测试用例时,测试运行器首先运行我的 groovy 脚本,然后再次运行“MyTestStep”。
这不是我想要的。
关于如何仅从 groovy-script 运行测试步骤的建议?
--MyTestCase
---TestStep1 GroovyScript that executes teststep2 two times
---TestStep2: MyTestStep containing a rest request
因此,当我按下 MyTestCase 的播放时:第一个 groovy 脚本启动,这没关系。但随后测试继续再次执行 TestStep2。
解决方案
自从我弄清楚后,我就回答了自己的问题:而不是:
testRunner.runTestStepByName("MyTestStep2")
我用了:
testRunner.gotoStepByName("MyTestStep2")
推荐阅读
- java - Akka Http 解析实体 Java
- vb.net - 绘制位图时处理内存堆叠
- python - 从图像本地目录创建 tensorflow 数据集
- ruby-on-rails - ruby on rails 应用程序卡在 futex 'kill QUIT PID' 但乘客没有留下任何痕迹
- linux - 如何从模块代码中设置 linux 内核模块名称?
- ruby-on-rails - 复选框 - 不更改布尔值
- node.js - 如何在无服务器设置中可靠地连接到 Mongodb?
- php - 如何将其重定向到新标签?
- scala - 使用伪联合类型 js.Dictionary[js.Any] 时编译失败 | 空值
- maximo-anywhere - 我们如何向用户隐藏 Anywhere Work 执行应用程序中的连接设置?