![](/img/trans.png)
[英]Getting name of previous test step of type Rest Request in SoapUI groovy script
[英]getting name of previous test step in SoapUI groovy script
我不熟悉SoapUI中的常规脚本,并且对可用信息量有些困惑,因此我可能只是忽略了答案。
加载GroovyUtils的脚本中有一个方法context.getCurrentStep()
。 但是,在脚本步骤中,这当然会返回脚本步骤本身的名称。
现在,我想访问上一步的名称(更确切地说是响应),而无需显式使用其名称。 有一个简单的方法可以做到这一点吗?
您可以执行以下操作:
def currentStepInd = context.currentStepIndex
def previousStep = testRunner.testCase.getTestStepAt(currentStepInd - 1)
log.info previousStep.name
API JavaDocs中提供了更多信息。
您需要在脚本中执行以下操作:
def response = context.expand( '${previous_step_name#Response#}' )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.