【问题标题】:SoapUI - Control flow from groovySoapUI - 来自 groovy 的控制流
【发布时间】:2021-01-21 15:03:07
【问题描述】:

在我的 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 一次。

【问题讨论】:

  • 您只需运行 Groovy 步骤,而不是整个测试即可。
  • 你是什么意思?
  • 我什至尝试过使用 testRunner.runTestStepByName("TestStep2")。但是当我开始我的测试用例时,它首先执行 groovy 脚本,然后执行已经从 groovy 脚本执行的测试步骤 2。这会导致我的测试出错,因为其中有 iäve 断言。请参阅我更新的问题。
  • “但是当我开始我的测试用例”。如果您运行脚本本身而不是测试用例,它将起作用。

标签: groovy soapui


【解决方案1】:

我回答了我自己的问题,因为我想通了: 而不是:

testRunner.runTestStepByName("MyTestStep2")

我用过:

testRunner.gotoStepByName("MyTestStep2")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-19
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多