You are on page 1of 28

SOAP UI GUIDE

Table of Contents
Table of Contents........................................................2 1 Introduction.............................................................3 2 How to create a Test Suite?..........................................4 3 How to add requests in a test suite?.................................7 4 Modify Pass/Fail reporting option in a Test Case?................11 5 Set the Aut credentials ..............................................13 6 Set end point URL for requests.....................................17 7 Running TestRequests and TestCase...............................20 8 Assertions:.............................................................23

1 Introduction
SoapUI structures functional tests into three levels; TestSuites, TestCases and TestSteps. 1. A TestSuite is a collection of TestCases that can be used for grouping functional tests into logical units. Any number of TestSuites can be created inside a soapUI project to support massive testing scenarios. 2. A TestCase is a collection of TestSteps that are assembled to test some specific aspect of your service(s). You can add any number of TestCases to a containing TestSuite and even modularize them to call each other for complex testing scenarios. 3. TestSteps are the "building blocks" of functional tests in soapUI. They are added to a TestCase and used control the flow of execution and validate the functionality of the service(s) to be tested.

Lets look at these in a little more detail: TestSuites (as mentioned above) are created at the project level for grouping TestCases into logical units. For example we can have one TestSuite with account-related TestCases and another for TestCases related to payments. Our project can contain any number of TestSuites and we can see and execute them all (in sequence or parallel) from the Project TestSuites tab. This has been explained in detail in this document.

2 How to create a Test Suite?


2.1 Create a Project in soapUI

2.1.1

Goto File New soapUI Project

2.1.2

Provide Project Name and WSDL path (file system path). And press OK.

2.1.3

New project has been created:

2.2 Create Test Suite


2.2.1 Right click on the project created and select option New TestSuite

2.2.2

Provide a name for the Test Suite and press OK

2.2.3

A new test suite has been created, as shown below;

3 How to add requests in a test suite?


3.1 Create a new TestCase
3.1.1 Right click on the TestSuite that you created and select option New TestCase, as shown below:

3.1.2

Provide a name to the new TestCase and press OK, as shown below:

3.1.3

A new TestCase has been created inside out TestSuite, as shown below;

3.2

Create new empty request.


3.1.1 Right click on the new TestCase that has been created and select option Add Step SOAP Test Request, as shown below;

3.1.2

Specify the name for the request XML, and press OK, as shown below; 8

3.1.3

Then Select the operation that the request will invoke, as shown below;

3.1.4

And press OK.

3.1.5

Then select the options, and press OK again.

3.1.6

An empty Input XML has been created.

10

4 Modify Pass/Fail reporting option in a Test Case?


We can declare a TestCase inside a TestSuite as Failed, even if a single TestStep fails inside the TestCase. This can be achieved by following the below mentioned steps;

4.1

Right click on the TestCase inside the TestSuite, and select Options, as shown below;

11

4.2

Uncheck the checkbox Abort on error and check the checkbox Fail TestCase on Error, and press OK.

After making these changes, a TestCase will be shown as failed if even a single step inside the TestCase fails. And the execution of the TestCase will not stop when a TestStep fails.

12

5 Set the Aut credentials


5.1 Set the Aut credentials (Username and password) for a single request in the TestCase. 5.1.1
Double click on the Request, for which the credentials have to added, and then select the tab Aut at the bottom of the request, as shown in the image below;

5.1.2

The following screen will appear. Provide username and password.

13

5.2 Set the Aut credentials (Username and password) for all the requests in a TestCase.
5.2.1 Double click on the TestCase that you created. The following screen will appear;

5.2.2

Select the Key present on the title bar, as shown in the image below;

14

5.2.3

The following screen will appear.

5.2.4

Provide Username and Password and press OK. This will set the same username and password for all requests present in this particular TestCase.

15

16

6 Set end point URL for requests


6.1 Different end point URLs for different requests
6.1.1 Double click on the Request, for which the end point URL has to be set;

6.1.2

On the address bar, select option Edit Current and provide the desired end point url, and press OK;

17

6.2 Same end-point URL for all the requests in a TestCase: 6.2.1
Double click on the TestCase that you created. The following screen will appear;

6.2.2

Select the URL button present on the title bar;

18

6.2.3

Set the end-point URL and press OK. This will set the same end-point URL for all the requests present in the TestCase.

19

7 Running TestRequests and TestCase


7.1 Running individual TestRequests 7.1.1
Double click on the TestRequest that has to be run and press run image, present on the tool bar, as shown below;

20

7.2

Running all requests present in a TestCase


7.2.1 Right click on the TestCase that needs to be run, and goto Options, as shown below;

7.2.2

The following screen will appear. Uncheck option Abort on Error. And press OK.

21

7.2.3

Double click on the TestCase that needs to be run. Screen similar to the following will appear;

7.2.4

Select the green arrow, present on the tool bar. This will run all the test cases present in the TestCase.

7.2.5

After all TestRequests inside a TestCase have been executed, the following screen will appear;

22

8 Assertions:
Now that we've created our test, we are going to add a validation of the response. In soapUI, this is called adding an assertion. soapUI contains several functions that enhances automation for those who spends their days (and nights) testing and are in need of extensive assertions. Examples of assertions that are possible in soapUI are: Schema Compliance Simple Contains Simple Not Contains SOAP Fault Not SOAP Fault SOAP Response Response SLA XPath Match XQuery Match Script Assertion WS-Security Status WS-Addressing Response Assertion WS-Addressing Request Assertion

8.1

Adding assertions at the time of creating request XML. 8.1.1


Right click on the TestCase name in which the request XML has to be added, and select option Add Step SOAP Test Request

23

8.1.2

Provide the name of the request and press OK.

8.1.3

Select the operation from the dropdown and press OK, as shown below;

8.1.4

The following four assertion options are provided at this stage. Whatever option is application in your case, select those and press OK.

24

8.1.5

A new blank XML has been created with the assertions applied, as shown in the image below;

8.2 How to add assertions?


8.2.1 Double click and open the request XML for which an assertion has to be added. The following screen will appear.

25

8.2.2

In the request editor, Click the Add an Assertion to Test Request button.

8.2.3

From the dropdown select the assertion that has to be implemented. Example - Select Response SLA from the drop down in the Select Assertion dialog box.

8.2.4

In the Configure Response SLA Assertion dialog box, write 500 and click OK. This will validate that the response of the SLA is under 500.

26

8.2.5

Now that weve added the assertion, we are going to run the request to validate the response. If all assertions are successful, the SOAP icon will turn green in three places as shown below.

8.3

How to find how many assertions have been applied to a request XML? 8.3.1
The number of assertions that have been applied on the Response can be verified from the Assertion tab. As shown below there are 3 assertions applied on this response.

27

28

You might also like