![[SoapUI] 检查测试步骤的类型或者或者某种特定类型的步骤列表 [SoapUI] 检查测试步骤的类型或者或者某种特定类型的步骤列表](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
SoapUI Groovy : Check if test step is of specific type, such as : Wsdl, Rest, Jdbc, HTTP, Groovy etc
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 if (step instanceof WsdlTestRequestStep) {
log.info "Found a request step of Wsdl/Soap type"
} else if (step instanceof RestTestRequestStep) {
log.info "Found a request step of Rest type"
} else if (step instanceof JdbcRequestTestStep) {
log.info "Found a request step of jdbc type "
} else if (step instanceof HttpTestRequestStep) {
log.info "Found a request step of http type "
}
SoapUI Groovy: Get all test steps of specific type
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep def testSuiteList = testRunner.testCase.testSuite.project.getTestSuiteList()
for(testSuite in testSuiteList){
testCaseList = testSuite.getTestCaseList()
for(testCase in testCaseList){
testStepList = testCase.getTestStepsOfType(RestTestRequestStep)
for (testStep in testStepList){
testStepName = testStep.name
}
}
}
More test step types please see from SoapUI API documentation:
https://support.smartbear.com/readyapi/apidocs/soapui/com/eviware/soapui/impl/wsdl/teststeps/package-summary.html