chiangy77 chiangy77 - 1 year ago 211
Groovy Question

SoapUI Groovy: Check if test step is a soap request

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
if this is relevant information.

Rao Rao
Answer Source

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) { "Found a request step of Wsdl/Soap type"
   //do the stuff you wanted

} else if (step instanceof RestTestRequestStep) { "Found a request step of Rest type"
    //do the stuff you wanted   
} else if (step instanceof JdbcRequestTestStep) { "Found a request step of jdbc type "
    //Do the stuff you wanted
} else if (step instanceof HttpTestRequestStep) { "Found a request step of http type "
     //do the stuff for http                
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download