1

Is there a way to check if a certain test step is a soap request?

Currently I have a Groovy Script at the end of the test case and looping through all the test steps to record the requests and responses.

I would like to ignore steps that aren't requests. I am accessing each step by using context.testCase.getTestStepAt(i) if this is relevant information.

Rao
  • 20,781
  • 11
  • 57
  • 77
chiangy77
  • 163
  • 1
  • 5
  • 14

1 Answers1

4

Yes, it is possible to find if the step is of specific type such as Wsdl, REST, Jdbc, HTTP, Groovy etc in a Groovy Script step.

Please the below script for the same.

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                
}
Rao
  • 20,781
  • 11
  • 57
  • 77