ProductivityAndFun Download Trial - Free 14 day evaluation

Running from the Command Line

PDF Print E-mail
User Rating:  / 45
Rate this article: PoorBest 

Running From The Command Line

SoapUI currently comes with the following command line tools for running TestCases and LoadTests

Tool Description Name
SoapUITestCaseRunner Runs specified TestCases and reports/exports results as configured testrunner
SoapUILoadTestRunner Runs specified LoadTests and reports/exports results as configured loadtestrunner
SoapUIMockServiceRunner Runs specified MockServices mockservicerunner
SoapUISecurityTestRunner Runs specified MockServices securitytestrunner
SoapUIToolRunner Runs any of the configured Code Generation tools for specified project and interface toolrunner
soapUI Maven 1.X/2.X plug-ins Allows execution of the above two from within a Maven 1.X/2.X build environment

Finding the runners

The runners are by default installed inside the SoapUI installation folder, in the bin folder.

General syntax

Invoking testrunners from command line is simply a matter of running the .sh/.bat script, with added parameters as necessary.

Example:

testrunner.bat -FPDF -R"Project Report" c:\projects\my-soapui-project.xml
tool parameters report project

TestRunner description of parameters

Running functional tests from the command-line is straightforward using the included testrunner.bat/.sh script, which takes a number of arguments to control which tests to run, output, etc:

  • a : Turns on exporting of all test results, not only errors
  • A : Turns on exporting of all results using folders instead of long
  • c : The TestCase to run, used to narrow down the tests to run
  • D : Sets system property with name=value
  • d : The domain to use in any authentications, overrides any domain set for any TestRequests
  • e : The endpoint to use when invoking test-requests, overrides the endpoint set in the project file
  • E : Sets which environment to use (SoapUI Pro only)
  • F : Sets the format of the report specified with the -R option, for Printable reports this is one of PDF, XLS, HTML, RTF, CSV, TXT, and XML. For Data Export this is either XML or CSV (SoapUI Pro only)
  • f : Specifies the root folder to which test results should be exported (see below)
  • G : Sets global property with name=value
  • g : Sets the output to include Coverage HTML reports ( SoapUI Pro only )
  • h : The host:port to use when invoking test-requests, overrides only the host part of the endpoint set in the project file
  • I : Do not stop if error occurs, ignore them
  • i : Enables SoapUI UI-related components, required if you use the UISupport class for prompting or displaying information
  • j : Turns on exporting of JUnit-compatible reports, see below
  • M : Creates a Test Run Log Report in XML format
  • m : Sets the maximum number of TestStep errors to save for each TestCase
  • o : Opens the generated report in a browser (SoapUI Pro only)
  • P : Sets project property with name=value, e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2
  • p : The password to use in any authentications, overrides any password set for any TestRequests
  • r : Turns on printing of a small summary report (see below)
  • R : Selects which report to generate for the test objects executed, for example if running the entire project, this could specify the name of a test-suite-level report that would be generated for each TestSuite. The report is saved as specified with the -F option to the folder specified with the -f option. (SoapUI Pro only)
  • S : Sets to save the project file after tests have been run
  • s : The TestSuite to run, used to narrow down the tests to run
  • t : Sets the soapui-settings.xml file to use, required if you have custom proxy, ssl, http, etc setting
  • u : The username to use in any authentications, overrides any username set for any TestRequests
  • v : Sets password for soapui-settings.xml file
  • w : Sets the WSS password type, either 'Text' or 'Digest'
  • x : Sets project password for decryption if project is encrypted

So for example:

testrunner.bat -FPDF -R"Project Report" c:\projects\my-soapui-project.xml

Runs all tests in the specified my-soapui-project.xml file and creates the default project report available with SoapUI Pro.

The included loadtestrunner.bat/.sh file (available in the /bin folder) can be used to run LoadTests from the command line which can be used for surveillance testing and maximizing local testing. The runner will run each specified LoadTest in turn, but be careful not to run LoadTests with an indefinite test limit.

The following arguments are available:

  • e : The endpoint to use when invoking test requests, overrides the endpoint set in the project file
  • h : The host:port to use when invoking test requests, overrides only the host part of the endpoint set in the project file
  • s : The TestSuite to run, used to narrow down the tests to run
  • c : The TestCase to run, used to narrow down the tests to run
  • l : The LoadTest to run, used to narrow down which LoadTests to run
  • m : Overrides the limit value set for the specified LoadTest(s)
  • n : Overrides the thread-count value set for the specified LoadTest(s)
  • u : The username to use in any authentications, overrides any username set for any TestRequests
  • p : The password to use in any authentications, overrides any password set for any TestRequests
  • d : The domain to use in any authentications, overrides any domain set for any TestRequests
  • r : Turns on exporting of a LoadTest statistics summary report (see below)
  • f : Specifies the root folder to which test results should be exported (see below)
  • w : Sets the WSS password type, either Text or Digest
  • t : Sets the soapui-settings.xml file to use, required if you have custom proxy, ssl, http, etc settingx : Sets project password for decryption if project is encrypted
  • 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 tests
  • R : Selects which report to generate for the executed LoadTest(s), the report is saved as specified with the -F option to the folder specified with the -f option. (soapUI Pro only)
  • F : Sets the format of the report specified with the -R option, for Printable reports this is one of PDF, XLS, HTML, RTF, CSV, TXT, and XML. Note: to specify multiple report formats in the same command use this syntax "-FPDF -FHTML" without the quotes. For Data Export this is either XML or CSV (soapUI Pro only)
  • o : Opens the generated report in a browser (soapUI Pro only)
  • E : Sets which environment to use (soapUI Pro only)

So for example running

loadtestrunner.bat -ehttp://localhost:8080/services/MyService c:\projects\my-soapui-project.xml

will run all the LoadTests defined in the my-soapui-project.xml file against the specified service-endpoint.

Running large number of threads

See the article Threads for information about running more than 200 threads.

Running SecurityTests from the command-line is straightforward using the included securitytestrunner.bat/.sh script, which takes a number of arguments to control which SecurityTest(s) to run, output, etc:

  • e : The endpoint to use when invoking test-requests, overrides the endpoint set in the project file
  • h : The host:port to use when invoking test-requests, overrides only the host part of the endpoint set in the project file
  • s : The TestSuite containging the SecurityTests to run, used to narrow down the tests to run
  • c : The TestCase containging the SecurityTests to run, used to narrow down the tests to run
  • n : The name of the SecurityTest to run
  • u : The username to use in any authentications, overrides any username set for any TestRequests
  • p : The password to use in any authentications, overrides any password set for any TestRequests
  • w : Sets the WSS password type, either 'Text' or 'Digest'
  • d : The domain to use in any authentications, overrides any domain set for any TestRequests
  • r : Turns on printing of a small summary report (see below)
  • f : Specifies the root folder to which test results should be exported (see below)
  • j : Turns on exporting of JUnit-compatible reports, see below
  • a : Turns on exporting of all test results, not only errors
  • o : Opens the generated report in a browser (soapUI Pro only)
  • i : Enables soapUI UI-related components, required if you use the UISupport class for prompting or displaying information
  • t : Sets the soapui-settings.xml file to use, required if you have custom proxy, ssl, http, etc setting
  • 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 : Sets to save the project file after tests have been run
  • I : Do not stop if error occurs, ignore them
  • R : Selects which report to generate for the test objects executed, for example if running the entire project, this could specify the name of a test-suite-level report that would be generated for each TestSuite. The report is saved as specified with the -F option to the folder specified with the -f option. (soapUI Pro only)
  • F : Sets the format of the report specified with the -R option, for Printable reports this is one of PDF, XLS, HTML, RTF, CSV, TXT, and XML. For Data Export this is either XML or CSV (soapUI Pro only)
  • g : Sets the output to include Coverage HTML reports ( soapUI Pro only )

So for example:

securitytestrunner.bat -FPDF -R"SecurityTest Report" c:\projects\my-soapui-project.xml

Runs all tests in the specified my-soapui-project.xml file and creates the default SecurityTest report available with soapUI Pro.

Running Mock Services 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 ( soapUI Pro only )
  • o : Opens the Coverage Report in a browser (with the -g option) ( soapUI Pro only )
  • g : Sets the output to include Coverage HTML reports ( soapUI Pro only )

The distribution contains a mockservicerunner.bat script for running MockServices in the bin directory, for example;

mockservicerunner.bat -m "IOrderService MockService" "C:\Documents and Settings\Ole Matzura\My Documents\demo2-soapui-project.xml"

Runs the specified MockService as follows:

SoapUI SNAPSHOT MockService Runner
15:08:15,515 INFO [SoapUI] Added [file:/C:/workspace/core/ext/mysql-connector-java-5.0.4-bin.jar] to classpath
15:08:16,375 INFO [SoapUI] initialized soapui-settings from [soapui-settings.xml]
15:08:16,406 INFO [WsdlProject] Loaded project from [C:\Documents and Settings\Ole Matzura\My Documents\demo2-soapui-project.xml]
15:08:17,609 INFO [SoapUIMockServiceRunner] Running MockService [IOrderService MockService] in project [demo]
15:08:17,609 INFO [SoapUIMockServiceRunner] Press any key to terminate
15:08:17,953 INFO [MockEngine] Started mockService [IOrderService MockService] on port [8081] at path [/mockIOrderService]
15:08:17,953 INFO [SoapUIMockServiceRunner] MockService started on port 8081 at path [/mockIOrderService]
Progress: 1 - Loading definition from cache
15:09:18,625 DEBUG [WsdlContext] Loading definition from cache
15:09:18,640 DEBUG [WsdlLoader] Returning baseInputSource [http://evitop:8080/OrderServiceImpl?wsdl]
15:09:18,687 DEBUG [WsdlLoader] Returning baseURI [http://evitop:8080/OrderServiceImpl?wsdl] Retrieving document at 'http://evitop:8080/OrderServiceImpl?wsdl'.
15:09:18,796 DEBUG [WsdlContext] Loaded definition: ok
15:09:18,812 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/xop.xsd with targetNamespace http://www.w3.org/2004/08/xop/include
15:09:18,890 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/XMLSchema.xsd with targetNamespace http://www.w3.org/2001/XMLSchema
15:09:18,890 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/xml.xsd with targetNamespace http://www.w3.org/XML/1998/namespace
15:09:18,890 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/swaref.xsd with targetNamespace http://ws-i.org/profiles/basic/1.1/xsd
15:09:18,890 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/xmime200505.xsd with targetNamespace http://www.w3.org/2005/05/xmlmime
15:09:18,890 INFO [SchemaUtils] Added default schema from /C:/workspace/core/target/classes/xmime200411.xsd with targetNamespace http://www.w3.org/2004/11/xmlmime
15:09:18,890 WARN [SchemaUtils] Failed to open schemaDirectory [C:\workspace\soapui-pro\schemas]
15:09:18,890 INFO [SchemaUtils] Loading schema types from [http://evitop:8080/OrderServiceImpl?wsdl]
15:09:18,890 INFO [SchemaUtils] Getting schema http://evitop:8080/OrderServiceImpl?wsdl
15:09:18,906 INFO [SchemaUtils] schema for [http://www.example.org/OrderService/] contained [{}] namespaces
15:09:19,359 INFO [SoapUIMockServiceRunner] Handled request 1; [purchase] with [MockResponse 1] in [9ms] at [2007-04-03 15:09:17.968]
15:09:20,734 INFO [SoapUIMockServiceRunner] Handled request 2; [purchase] with [MockResponse 2] in [0ms] at [2007-04-03 15:09:20.734]
15:09:21,296 INFO [SoapUIMockServiceRunner] Handled request 3; [purchase] with [MockResponse 1] in [0ms] at [2007-04-03 15:09:21.296]
15:09:21,937 INFO [SoapUIMockServiceRunner] Handled request 4; [purchase] with [MockResponse 2] in [0ms] at [2007-04-03 15:09:21.937]
15:09:22,343 INFO [SoapUIMockServiceRunner] Handled request 5; [purchase] with [MockResponse 1] in [0ms] at [2007-04-03 15:09:22.343]

Which can now be invoked from soapUI or any other client. Terminate the runner by pressing the return key in the console, which will shutdown as follows:

15:20:30,703 INFO  [MockEngine] Stopping connector on port 8081
15:20:30,703 INFO  [MockEngine] No more connectors.. stopping server
15:20:30,703 INFO  [SoapUIMockServiceRunner] MockService stopped, handled 7 requests
15:20:30,703 INFO  [SoapUIMockServiceRunner] time taken: 733117ms

 

 

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 ( soapUI Pro 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
=
================================

SoapUI Pro 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...