Tuesday, May 17, 2011

TestRunner - soapUI project execution from command line

Folks, in this post i will be covering the use of test runner - by which you can execute your soapUI projects (from command line) without opening soapUI application.

This feature will by very useful when you want to perform the regression test on the newly deployed code & to store the response data in some files. And execution can be done by anyone (including people who don't know "how to use soapUI").

testrunner.bat (soapui_install_dir/bin folder) is a command line utility which is getting called whenever we execute our testcases with some predefined (or userdefined) conditions. In soapUI application, right click on any selected testcase/test suite and then select "launch test runner" from the context menu to call the test runner.bat file. This will open a new window wherein you can provide the required configuration data like, testcase/testsuite to be executed, endpoint url, folder to store the response, ignore the error results and so on.
 After providing all the details, start the testrunner.bat by clicking launch button. In the window it will display the command line arguments being passed for the selected combination of input data.

Similarly, you can directly call the testrunner.bat from the command line utitlity and provide those parameters to perform the test execution. This will save lot of time to perform the test execution and also it can be executed by anyone (in your absence).
I have created a simple batch file (my_soapUI.bat) to perform this set of activity. So to perform the regression test, i need to just execute the "my_soapUI.bat" file from the command line and rest would be taken care.

cd C:\Program Files\eviware\soapUI-Pro-3.6\bin
testrunner.bat -ehttp:// -sLoad_Test_Apr2011_TestSuite -r -a -fD:\Automate\store_response -I "C:\Documents and Settings\pradeep.bishnoi\My Documents\my_soapui-project.xml"

:: To override the endpoint for the teststeps use
:: -e(Endpoint URL)                
:: -ehttp://x.x.x.x/WebService.svc

:: TestSuite to run, used to narrow down the tests to run
:: -s(TestSuite Name under the project)                
:: -sTestSuiteSoapUI

:: TestCase to run, used to narrow down the tests to run
:: -c(TestCase Name under the project/testSuite)                
:: -cTestCaseSoapUI

:: r : Turns on printing of a small summary report. To be used when you want to save generated reports
:: -r                

:: f : Specifies the root folder to which test results should be exported
:: -f(Complete path of the folder where to save the response)
:: -fD:\soapUI\responseReport

:: a : Turns on exporting of all test results, not only errors. To be used when you want to export both passed and failed test step reports
:: -a                

:: I : Do not stop if error occurs, ignore them. Execution will continue even when any test step fails/error comes.
:: -I                

:: After providing all the parameters, pass the complete soapUI project file location in double quotes "" which contains the above mentioned testSuite & testCases for execution.
:: example      "C:\soapui-project.xml"
To use the same, just copy the code lines (in yellow colored font) and save them into a "my_soapUI.bat" file and edit the required parameters like endpoint, project file name, and folder to store the response etc.

EndNote : Biggest advantage of using the command line approach is #Faster execution since we are directly executing the project without opening the soapUI.


  1. Hello Pradeep,Very good blog and I have been following your blogs for quite sometime.

    I had a question regarding Soap UI Automation:
    I have been developing a SOA framework and evaluating if Soap UI Pro can be integrated to the framework. I was able to run my sample automation script through the Command prompt and was able to capture the results as well in a text file (Request, Response and endpoint). But is it possible to capture the “Test case Runner “summary like the Total no. of Test suite, Total Test cases, No. of Test steps, No. of Assertions etc as well in a text file somewhere (The below details are shown in the comand prompt console). But can these details be exported to a text file.

    SoapUI 4.0.1 TestCaseRunner Summary
    Time Taken: 1226ms
    Total TestSuites: 0
    Total TestCases: 1 (1 failed)
    Total TestSteps: 4
    Total Request Assertions: 1
    Total Failed Assertions: 0
    Total Exported Results: 4


    1. Hi Prashanth,

      Yes should be possible and for the same we need to find the soapUI testrunner handle/object. As of now, i don't have the object/method name handy with me.

      So i would suggest to implement this using your own script code lines. Like creating a counter variable at project level for testsuite, testcases, teststep and then using .count() method for testsuite,testcase, teststep to update + append the values.

      To count assertion add a script assertion in each teststep which would count the assertion of that teststep and update [rather add] in existing assertion count value.

      I know this would require quite a bit effort. Hope this will help.

      P.S : I might not reply to the comments posted on this blog. For all the latest blog, comments & suggestion do follow learnsoapui.wordpress.com

      /Pradeep Bishnoi

  2. hi,we provide online training & video tutorial for soapui
    for free videos refer