简体   繁体   English

使用Groovy创建soapUI脚本断言

[英]Creating soapUI script assertion using groovy

I know that in soapUI test request and in the assertion panel, it's possible to create a script assertion with a groovy script. 我知道在soapUI测试请求和断言面板中,可以使用常规脚本创建脚本断言。

What I need is to create a script assertion with a script, but not through the test request, but by a separate groovy script itself. 我需要的是使用脚本创建脚本断言,而不是通过测试请求,而是通过单独的常规脚本本身创建脚本断言。 Is it possible to create a script assertion for a soapUI request with the help of Groovy Script itself? 是否可以借助Groovy脚本本身为soapUI请求创建脚本断言?

I have found out the answer and here it is. 我找到了答案,就在这里。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM