Hi,
Sorry, I haven't been able to give more direct help, things are fairly busy work-wise.
Whilst you're feeling frustrated, you shouldn't, if you're new to java / groovy, then I would say you're actually doing pretty well! By the way, I know other SoapUI users do similar things to what you are trying to do, but I would say what you're doing should be considered an advanced usage of SoapUI, and isn't something people are likely to just know without actually following your steps.
Just taking a quick look at your script (haven't executed it myself), I was thought that there might be a chance that using testRunner variable to resolve the interface list might cause the TestCase creation to end up referencing the project that the script is actually running in rather than your new project?
for (iFace in testRunner.testCase.testSuite.project.getInterfaceList()) {
//for (iFace in testRunner.tc.suite.project.getInterfaceList()) {
if (iFace.getName().matches(".*?[0-9]")) {
for (operation in iFace.getOperationList()) {
TStepC = WsdlTestRequestStepFactory.createConfig(operation, operation.getName());
testStep = tc.addTestStep(TStepC);
}
I was looking in the source code for something similar to creating TestCase / TestSteps, and I saw the Action
GenerateWsdlTestSuiteAction
This is the code that the menu 'Action' runs. It has a method:
private void generateSingleTestCase(WsdlTestSuite testSuite, WsdlInterface iface, boolean useExisting,
boolean createLoadTest, List<String> operations) {
WsdlTestCase testCase = testSuite.addNewTestCase(iface.getName() + " TestSuite");
for (int i = 0; i < iface.getOperationCount(); i++) {
WsdlOperation operation = iface.getOperationAt(i);
if (!operations.contains(operation.getName())) {
continue;
}
if (useExisting && operation.getRequestCount() > 0) {
for (int x = 0; x < operation.getRequestCount(); x++) {
testCase.addTestStep(WsdlTestRequestStepFactory.createConfig(operation.getRequestAt(x),
operation.getName()));
}
} else {
testCase.addTestStep(WsdlTestRequestStepFactory.createConfig(operation, operation.getName()));
}
}
if (createLoadTest) {
testCase.addNewLoadTest("LoadTest 1");
}
}
Maybe this could be stripped down and adapted to your needs or give clues?
Also, I think you might need to create the WSDL service definitions in the new project? Otherwise when you create the new TestSteps, they might reference the WSDL service definitions in the original project, which I don't think is what you actually want. SoapUI can have this type of issue when cloning existing objects that reference service definitions e.g. the new objects end up referring back.
Hope this makes sense. Just guesses at the moment, but I think you're probably quite close.
Regards,
Rup