Get teststep of specific type

SoapUI Groovy : Check if test step is of specific type, such as : Wsdl, Rest, Jdbc, HTTP, Groovy etcui

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 typespa

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
        }
    }
}
相關文章
相關標籤/搜索