在SoapUI groovy脚本中获取先前测试步骤的名称

Tho*_*mas 1 groovy automated-tests soapui

我是SoapUI中的groovy脚本新手,对可用信息量有点困惑,所以我可能只是忽略了这个问题的答案.

context.getCurrentStep()脚本中有一个方法可以加载GroovyUtils.但是在脚本步骤中,当然会返回脚本步骤本身的名称.

现在我想要显式地访问上一步的名称(更确切地说是响应)而不使用它的名称.是否有一种简单的方法可以实现这一目标?

SiK*_*ing 7

你可以这样做:

def currentStepInd = context.currentStepIndex
def previousStep = testRunner.testCase.getTestStepAt(currentStepInd - 1)
log.info previousStep.name
Run Code Online (Sandbox Code Playgroud)

API JavaDocs中提供了更多信息.