How do you use a Groovy script to clone a TestSuite from one project to another?
I found the interface
Interface CloneTestSuiteAction.Form
in the SoapUI API docs, but I am unsure how to use to it to implement the cloning.
The clone would be something like moving the TestSuite "Example" from Project 1 to Project 2.
Any help would be greatly appreciated. Thanks!
The challenge here is that the Test Suite probably refers to existing Interfaces (WSDLs, WADLs) in the source project, and in order for the copy to work in the new project, the interfaces need to be copied too.
SoapUI does that for you when you right click and Clone Test Suite. And that right click action is what you get when you are using CloneTestSuiteAction from Groovy. It works, and I've included an example of this in the attached project file.
import com.eviware.soapui.impl.wsdl.actions.testsuite.CloneTestSuiteAction
def sourceTestSuite = context.getTestCase().getTestSuite().getProject()
.getTestSuiteByName("Simple TestSuite")
CloneTestSuiteAction.cloneToAnotherProject (
sourceTestSuite,
"Destination project using original action",
"New copy of Simple TestSuite",
false, //move instead of copy?
sourceTestSuite.description
)Unfortunately it looks like that action is hard coded to prompt the user for some of the settings, so perhaps thats not what you wanted.
It is possible to "steal" that same code and modify it to behave the way you want. And so in the attached project, I also show you how that's done with a script that clones the test suite without input from the user.