使用groovy创建soapUI脚本断言

使用groovy创建soapUI脚本断言,soap,groovy,Soap,Groovy,我知道在soapUI测试请求和断言面板中,可以使用groovy脚本创建脚本断言 我需要的是用一个脚本创建一个脚本断言,但不是通过测试请求,而是通过一个单独的groovy脚本本身。是否可以在Groovy脚本本身的帮助下为soapUI请求创建脚本断言?我已经找到了答案,就在这里 def stepname = testRunner.testCase.testSuite.getPropertyValue("TestRequestStepName") def assertion = testRunner.

我知道在soapUI测试请求和断言面板中,可以使用groovy脚本创建脚本断言


我需要的是用一个脚本创建一个脚本断言,但不是通过测试请求,而是通过一个单独的groovy脚本本身。是否可以在Groovy脚本本身的帮助下为soapUI请求创建脚本断言?

我已经找到了答案,就在这里

def stepname = testRunner.testCase.testSuite.getPropertyValue("TestRequestStepName")
def assertion = testRunner.getTestCase().getTestStepByName(stepname).addAssertion("Script Assertion")
assertion.setScriptText("hai from assertion.setScriptText.....")