Nice one! :-)
I was just about to send you this, here it is just incase it helps:
import com.eviware.soapui.SoapUI
import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.WsdlInterfaceFactory
import com.eviware.soapui.impl.wsdl.teststeps.*
import com.eviware.soapui.model.testsuite.TestCase
import com.eviware.soapui.model.testsuite.TestSuite
import com.eviware.soapui.impl.wsdl.teststeps.registry.*
WsdlProject project = new WsdlProject(SoapUI.workspace)
//Replace this with your WSDL
WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project,"http://www.webservicex.com/globalweather.asmx?WSDL", true)[0]
def newTestSuite = project.addNewTestSuite("testsuite1")
def newTestCase = newTestSuite.addNewTestCase ("testcase1")
for (operation in iface.getOperationList()) {
testStepConfig = WsdlTestRequestStepFactory.createConfig(operation, operation.getName());
newTestCase.addTestStep(testStepConfig);
}
//*** Logs operations (optional below this line, just for debug)
Iterator<com.eviware.soapui.model.iface.Operation> i = iface.getOperationList().iterator()
while (i.hasNext()) {
WsdlOperation op = (WsdlOperation) i.next()
log.info("Operation: " + op.getName())
}
List<TestSuite> testSuites = project.testSuiteList
testSuites.each{testSuite ->
log.info "Found TestSuite name ["+testSuite.name+"]"
List<TestCase> testCases = testSuite.testCaseList
testCases.each{testCase ->
log.info "Found TestCase ["+testCase.name+"]"
def testSteps = testCase.testSteps
testSteps.each {testStep ->
log.info "Found TestStep [" + testStep + "]"
}
}
}
It has some debugging code at the bottom to log the TestSuites, TestCases, TestSteps on the created project.
Yeah, using the testRunner like you did was referencing the old project.
So, now you can create the project, testsuite, testcase, teststeps, what next? Do you want to save the generated project?
Cheers,
Rup