2016-08-19 105 views
1

是否有方法检查某个测试步骤是否为肥皂请求?SoapUI Groovy:检查测试步骤是否是肥皂请求

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

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

回答

3

是的,可以在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     
}