Reputation: 318
Are there any command line parameters, or other ways, so that all the mock services start up when soap ui is started?
Upvotes: 8
Views: 5811
Reputation: 2422
If anyone tries this in SoapUi 5.7.0, you will have to uncheck the box for Disable the Load and Save Scripts before you can run any scripts. The setting can be found under File -> Preferences -> Global Security Settings.
If you don't uncheck this checkbox, neither load- nor save scripts will run. You will get a line in the SoapUI log that works as a hint:
Fri Jul 29 12:47:06 CEST 2022:WARN:In project 'ProjecName (YourService v1.1)' we have detected Save script that may contain malicious code, if you do not want to receive this message please change the setting in preferences.
Upvotes: 2
Reputation: 7383
I use this Groovy-script to start all mock-services in a project (set up in "Load Script"-tab in the Project View.
mockServicesCount = project.getMockServiceCount()
for (i in 0..(mockServicesCount-1)) {
project.getMockServiceAt(i).start();
i++;
}
Upvotes: -1
Reputation: 3273
Was looking same for rest mock services . For that use this instead ,from test suite setup script. Just in case anyone lands here while searching, like i landed. This can also be use from project or test case level by accordingly modifying it.
testSuite.project.getRestMockServiceByName("Service1").start()
Upvotes: 3
Reputation: 7067
As defined on the soapUI Support Forum, you can add the following code as a "load script" for your project:
for( mockService in project.mockServiceList )
{
def windowReference = com.eviware.soapui.support.UISupport.showDesktopPanel( mockService )
mockService.start()
com.eviware.soapui.SoapUI.desktop.minimize( windowReference )
}
soapUI Support Forum Reference:
http://forum.soapui.org/viewtopic.php?f=5&t=1138
Upvotes: 1
Reputation: 61
Since the mockServices is a Map this will also work:
project.mockServices.each() { entry -> entry.value.start() }
Upvotes: 6
Reputation: 503
You can automate this with the help of a Groovy Script.
Following script can be used as an example:
project.getMockServiceByName("name_of_your_mock_service_01").start();
project.getMockServiceByName("name_of_your_mock_service_02").start();
Upvotes: 7