繁体   English   中英

SoapUI Groovy:检查测试步骤是否为肥皂请求

[英]SoapUI Groovy: Check if test step is a soap request

有没有办法检查某个测试步骤是否是肥皂请求?

目前,我在测试用例的结尾处有一个Groovy Script ,并遍历所有测试步骤以记录请求和响应。

我想忽略不是要求的步骤。 如果这是相关信息, context.testCase.getTestStepAt(i)使用context.testCase.getTestStepAt(i)访问每个步骤。

是的,可以在Groovy Script步骤中查找该步骤是否为特定类型,例如Wsdl,REST,Jdbc,HTTP,Groovy等。

请同样使用以下脚本。

import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep
import com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep
import com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep

//....other stuff
//Initialise variable step before using it.
if (step instanceof WsdlTestRequestStep) {
    log.info "Found a request step of Wsdl/Soap type"
   //do the stuff you wanted

} else if (step instanceof RestTestRequestStep) {
    log.info "Found a request step of Rest type"
    //do the stuff you wanted   
} else if (step instanceof JdbcRequestTestStep) {
    log.info "Found a request step of jdbc type "
    //Do the stuff you wanted
} else if (step instanceof HttpTestRequestStep) {
     log.info "Found a request step of http type "
     //do the stuff for http                
}

暂无
暂无

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

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