My team and I currently have a few hundred tests scripted which we want to start automating. Instead of manually creating test cases in SoapUI, I have written a script which generates test cases with default properties. My next task is to insert a sample request for every REST service we have defined in our SoapUI project; I'm not too sure where to start with the SoapUI Groovy API, but below is a sample of my test creation script so far:
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory import com.eviware.soapui.impl.rest.RestResource; import com.eviware.soapui.impl.wsdl.teststeps.registry.RestRequestStepFactory import com.eviware.soapui.config.TestStepConfig import com.eviware.soapui.impl.rest.RestRequest; import com.eviware.soapui.impl.rest.RestService; listOfTestCases = [ 'Address Lookup with valid PostCode', 'Address Lookup with Valid CompanyName', 'Address Lookup with Valid Street', 'Address Lookup with Valid town', 'Address Lookup with Valid CompanyName & Postcode', 'Address Lookup with Valid Street & Postcode', 'Address Lookup with Valid Town & PostCode', 'Address Lookup with Valid CompanyName & Street', 'Address Lookup with Valid CompanyName & Town', 'Address Lookup with Valid Street & Town', 'Address Lookup with Valid Postcode, CompanyName, Street & Town'] for (String testCase : listOfTestCases) { tc = context.testCase.testSuite.addNewTestCase(testCase) tc.addProperty("testcycl-id") tc.addProperty("cycle-id") tc.addProperty("test-id") tc.addProperty("run-id") tc.addProperty("test-config-id") tc.addProperty("test-step-id") }
My question is thus: For every test case I have created, how do I insert one of every REST request?