SOAP UI is a powerful and easy to use open source tool for automating different types of web services like SOAP, REST etc. It provides a UI for creating test cases,assertions making it easier to develop test cases rapidly.

SOAP UI caters to the needs of functional, regression, load testing and provides  features like

  • Mock service simulation
  • Parallel execution of test cases
  • Schema compliance testing
  • WS-I compliance reporting
  • Generation of stubs for tools like AXIS2
  • Maven Integration
  • ANT integration
  • HTML reporting
  • WS Security support
  • Command line support
  • Scripting capabilities
  • Really good forum for support and a lot more.

This blog covers basic steps and information on how to start off with SOAP UI, create basic test cases and assertions and execute the test cases.

Install SOAP UI

Install the latest free version of SOAP UI from http://www.soapui.org/

Create a project

  1. Open SOAP UI.
  2. Click on file->new SOAP UI project
  3. Provide the URL to the WSDL in the project creation window and click OK. A service binding for the WSDL will be generated with all operations.

When the WSDL for a services changes, it can be updated without affecting the test cases by right clicking on the service binding and choosing update definition.

Generating test suite/test case

  1. Right click on the service binding and select “Generate TestSuite”. Select the operations for which sample test case template has to be generated. A test suite will be generated for the selected operations.
  2. Right click on the test suite to generate a new test case

Adding steps in a test case

When a new test case is added, right click on the test case and select add step -> test request.Select the operation for which the request needs to be sent.

Once test case is added, different steps to the test case can be added.These steps form the blocks of the test case which are executed in order.

How to pass parameters to tags

Values for the tags in the SOAP request can be hard coded or parametrized. There  are two ways of doing passing parameters/values

Creating properties to transfer values: Properties can be used to store data. These can act as variables which can be passed to the SOAP requests.

Properties at a project : Properties can be defined at project and these are available for all the test suites and all test cases. Double click on project and click on properties tab at the bottom to create properties

Properties at the test suite level : Properties which are defined at the test suite level are available for all the test cases and test steps inside the suite. Double click on test suite and click on properties tab at the bottom to create properties

Properties at the test case : Properties at the test case are available for only that test case and all the test steps inside the test case. Right click on test case and select add step -> properties to create properties for a test case.

Declaring properties using properties test step

Declaring properties

Transferring properties using properties transfer test step

Transferring properties

Data driven by external files: Is available only in the commercial version

Creating assertions

Assertions are at the heart of any test case where the actual testing happens

SOAP UI provides different types of assertions. Double click on a test request inside a test case . You will find an assertions tab at the bottom and different kinds of assertions can be added.

Assertions

Running the test cases

Running from UI :

Double click on a project or test suite or test case and click on run button to execute tests at that level. Passed test steps in each of the test suite are shown in green and failed ones in red.

Running test cases from UI

Running from command prompt:

SOAP UI test cases can also be run from command prompt by using the following command

com.eviware.soapui.tools.SoapUITestCaseRunner (options)

Few options available

-s   Test suite to run

-c  Test case to run

-r  Turn on printing of summary report

Another easier way is to run the tests is using the testrunner batch file which comes along with the SOAP UI installation at /bin

testrunner.bat -sTemperatureServiceBindingTestSuite -j -f E:\SOAPUITestReport E:\SOAP-API-Automation-soapui-project.xml

-s is for the test suite

-j indicates that junit style HTML report will be generated

-f is for speficying the folder for report generation

Mentioning the location of project XML is mandatory

Running from ANT:

An ANT tagert can be created which executes this command line task to integrate with the builds.


<target name=”runSOAPUISuite”>
<exec executable=”C:\Program Files\eviware\soapUI-3.5\bin\testrunner.bat”>
<arg line=’-sTemperatureServiceBindingTestSuite -j -f E:\SOAPUITestReport E:\SOAP-API-Automation-soapui-project.xml’/>
</exec>
</target>

Importing the test cases

The test suites and projects can be exported and imported to different machines and thus can be shared and executed by other team members very easily as it provides the same view on import.