首页 > 解决方案 > 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。

标签: groovysoapui

解决方案


自从我弄清楚后,我就回答了自己的问题:而不是:

testRunner.runTestStepByName("MyTestStep2")

我用了:

testRunner.gotoStepByName("MyTestStep2")

推荐阅读