Thursday, April 25, 2013

Run soapUI via Command-Line in Linux




I always wanted to run soapui load tests via command line because then I could run it on a remote machine that I SSH to. I don't want to run it on my machine because it slows down the machine considerably, so I can't do my day-to-day work with it. That will also affect the result of soapui.

Recently, I wanted to re-produce a OOM issue in WSO2 ESB. So, the setup was, the ESB instance was running on one server, soapui load tests, JConsole, and JProfiler on my machine. So, I only wanted to keep the monitoring softwares, ie. the JConsole, and JProfiler in my machine, and move the soapui tests to another server instance. It turned out this is actually pretty simple.

First, start up the soapui gui interface, and save the project you already have. If you don't have one, create a new one, and set all the load tests parameters appropriately. These include setting the soap message, no. threads, time limit etc. Let's save it as myProxy-test-soapui-project.xml.

This file, myProxy-test-soapui-project.xml, contains all the necessary information regarding the project. It include the WSDL file, the endpoints, load test info etc. This makes it easier run the same test on another machine. You just have to transfer this file. Then you can run the command in a terminal with soapui in place.



  • Transfer the saved soapui project file to the server where you wish to run the load tests. ex. scp
  • Download soaup from here - I got soapui-4.5.0-linux-bin.zip -  http://sourceforge.net/projects/soapui/files/soapui/4.5/
    • Let's called the extracted folder of this as $SOAPUI_HOME
  • Copy the following command, and change it to match your needs.


sh $SOAPUI_HOME/bin/loadtestrunner.sh -s"TestSuite Name" -c"Testcase name" -l"LoadTest name" -r -f/home/kasun/load-tests/reports/ /home/kasun/load-tests/myProxy-test-soapui-project.xml

Here, the names can be easily copied from the project hierarchy from the left-side Navigator tab.
Example command look like the following. Run it with nohup, so the process won't be killed if you disconnect from the server. 


sh /home/kasun/load-tests/soapui-4.5.0/bin/loadtestrunner.sh -s"myProxySoap11Binding TestSuite" -c"myProxySoap11Binding TestSuite" -l"LoadTest 1" -r -f/home/kasun/load-tests/reports/ /home/kasun/load-tests/myProxy-test-soapui-project.xml




4 comments:

  1. Excelent solution! I'm running the same need! Thanks a lot

    Regards,
    A Mancini

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Hello Kasun,
    can you tell me how we can execute a shell script from SoapUI ?
    Awaiting for your response.

    ReplyDelete
  4. @Kasun, Nice post.
    @Shrikant, haven't tried but you should be able to do it with Groovy step, JSch API is available for SSH.

    ReplyDelete