MockService Command Line
Note: If you want to run multiple mock services, be aware that multiple services on the same port is not supported. Only the one you started first will respond.
A workaround for this is to use the -p parameter, and have the services on different ports.
Running from Command Line
Running your MockServices from the command-line is equally simple; use the bundled mockrunner.bat/.sh file with the following arguments:
- m: The name of the MockService to run
- p : The local port to listen on, overrides the port configured for the MockService
- a : The local path to listen on, overrides the path configured for the MockService
- b : Turns off blocking when mockRunner has been started, which is required when wanting to run the MockServiceRunner with (for example) nohup or as a Windows Service
- s : The soapui-settings.xml file to use
- x : Sets project password for decryption if project is encrypted
- v : Sets password for soapui-settings.xml file
- D : Sets system property with name=value
- G : Sets global property with name=value
- P : Sets project property with name=value
- S : Saves the project after running the mockService(s)
- f : Sets the output folder to export results to ( ReadyAPI only )
The distribution contains a mockservicerunner.bat script for running MockServices in the bin directory, for example;
Windows:
C:\Program Files\SmartBear\SoapUI-Pro-5\bin\mockservicerunner.bat -m "Account creation mock" "C:\SoapUI projects\Sample REST Project-soapui-project.xml"
Linux:
bin $ ./mockservicerunner.sh -m "Account creation mock" "/home/usrsoapui/Documents/SoapUIProjects/Sample-REST-Project-soapui-project.xml"
Runs the specified MockService as follows (Linux):
================================
=
= SOAPUI_HOME = /home/usrsoapui/SmartBear/SoapUI-Pro-5.0
=
================================
ReadyAPI 5.0 MockService Runner
Configuring log4j from [/home/usrsoapui/SmartBear/SoapUI-Pro-5.0/bin/soapui-log4j.xml]
09:29:42,873 INFO [SoapUI] Adding [/home/usrsoapui/SmartBear/SoapUI-Pro-5.0/bin/ext/postgresql-8.3-604.jdbc3.jar] to extensions classpath
09:29:42,874 INFO [SoapUI] Adding [/home/usrsoapui/SmartBear/SoapUI-Pro-5.0/bin/ext/postgresql-8.3-604.jdbc4.jar] to extensions classpath
09:29:42,874 INFO [SoapUI] Adding [/home/usrsoapui/SmartBear/SoapUI-Pro-5.0/bin/ext/sqljdbc.jar] to extensions classpath
09:29:43,069 INFO [DefaultSoapUICore] initialized soapui-settings from [/home/usrsoapui/soapui-settings.xml]
09:29:43,238 INFO [DefaultSoapUICore] Adding listeners from [/home/usrsoapui/SmartBear/SoapUI-Pro-5.0/bin/listeners/demo-listeners.xml]
09:29:43,895 INFO [WsdlProject] Loaded project from [file:/home/usrsoapui/Documents/SoapUIProjects/Sample-REST-Project-soapui-project.xml"]
09:29:44,081 INFO [SoapUIProMockServiceRunner] Running MockService [REST MockService 1] in project [REST Mock Demo Project]
09:29:44,081 INFO [SoapUIProMockServiceRunner] Press any key to terminate
09:29:44,489 INFO [JettyMockEngine] Started mockService [REST MockService 1] on port [8080] at path [/]
09:29:44,489 INFO [SoapUIProMockServiceRunner] MockService started on port 8080 at path [/]
09:29:44,489 INFO [SoapUIProMockServiceRunner] Started 1 runner
Press any key to terminate...