SoapUI Groovy: 检查测试步骤是否是 soap 请求

SoapUI Groovy: Check if test step is a soap request

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

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

我想忽略不是请求的步骤。如果这是相关信息,我将使用 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                
}