I found the interface
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!
Solved! Go to Solution.
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.
def sourceTestSuite = context.getTestCase().getTestSuite().getProject()
"Destination project using original action",
"New copy of Simple TestSuite",
false, //move instead of copy?
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.
@JHunt, firstly, I really appreciate you taking the time to provide such a concise solution to my question.
I would like to offer some clarification regarding my projects and Test Suites.
The Projects that I'm working on are created by importing Swagger documentation. There are updates to this documentation over time, however since SoapUI Open Source does not allow you to re-import the Swagger documentation to the same project, I have to create new projects. However, the Test Suites that have been created in the previous Projects will always work in the new one (with the updated Swagger doc., mainly because there are only small updates), which is why I resort to MOVING the Test Suites using the Clone option.
The question I posted was in an attempt to automate this cloning/moving.
Will your code still work for this scenario?
It will work in the sense that the test suites will be copied across to the new project, but they will bring their own interfaces across with them. They won't pick up the interfaces that you just imported from Swagger, so you'll have two similar interfaces in your new project.
That might be okay for you?
Otherwise you can have your script change the Interface for each TestRequestStep (use setRestMethod).
I get what you're saying. So is there no way to move the test suites and have it pick up the new interface generated by the new Swagger import (or just not move the original interface at all), using the script?
I'm guessing that's what happens when I move Test Suites between projects manually?