Groovy 需要帮助-SoapUi testRunner.getStatus()正在将状态返回为;“运行”;无限期地

Groovy 需要帮助-SoapUi testRunner.getStatus()正在将状态返回为;“运行”;无限期地,groovy,soapui,Groovy,Soapui,执行soap请求测试步骤(在测试套件->测试用例下)后在SoapUI中 通过(“Soap请求名称”) 在soap请求执行后等待10秒,返回运行状态。下面是groovy脚本(在同一测试套件->测试用例下) 输出如下 Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING Wed Apr 17 21:06:

执行soap请求测试步骤(在测试套件->测试用例下)后在SoapUI中 通过(“Soap请求名称”)

在soap请求执行后等待10秒,返回运行状态。下面是groovy脚本(在同一测试套件->测试用例下)

输出如下

Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
.
.
continuing for infinite time...
理想情况下,由于执行了上述测试步骤,它应该返回已完成的


高级感谢您对此提供的任何帮助。

听起来很合乎逻辑,只要您在循环中,测试就会“运行”。您可以通过以下方式获取状态:

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
myTestStepResult = testRunner.runTestStepByName("GetCitiesByCountry - Request 1")
myStatus = myTestStepResult.getStatus()
if (myStatus == TestStepStatus.OK)
log.info "The step status is: " + myStatus.toString()
else
log.error "The step status is: " + myStatus.toString()
此外,由于对runTestStepByName的调用是同步的,因此没有“正在运行”状态,只有“已取消”、“失败”、“确定”或“未知”


谢谢@gaelperret。。。但是在上面的代码中,显示i值的soapui是0。。所以对于testRunner.results[i-1]。状态。。。。它给出了“数组索引超出范围异常:负数组索引[-1]…”。所以仍然会遇到同样的问题。@uday035,你是对的,只有当使用“runTestStepByName”运行的步骤正好在当前步骤之前时,上述代码才有效。我更正了我的答案。@gaelperret,根据说明,没有属性
TestStepStatus.CANCEL
,只有
TestStepStatus.CANCELED
import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
myTestStepResult = testRunner.runTestStepByName("GetCitiesByCountry - Request 1")
myStatus = myTestStepResult.getStatus()
if (myStatus == TestStepStatus.OK)
log.info "The step status is: " + myStatus.toString()
else
log.error "The step status is: " + myStatus.toString()