3) Functional Tests of Web Services
Introduction
Let's move on and look at how tests work in SoapUI. We have created three different TestSuites all containing different TestCases. A TestCase is made up of several steps, called TestSteps. The structure of a SoapUI project is like this;
- Project
- Interface
- TestSuites
- TestCases
- TestSteps
- LoadTests
- TestCases
- MockServices
As you can see there is also something called LoadTests, we can gather what they are, but we'll go into detail more what they actually do and how they actually work later.
Tutorial
Now let's examine a Functional Test in a TestCase.
- Expand the Sample Simple TestSuite and double click on Simple Login and Logout w. Properties Steps.

- As you can see the TestCase consist of five TestSteps.

- You can also click the Description tab in order to see the in test documentation.

- The step consists of three different types of TestSteps; One PropertyStep, Two TestRequests and Two PropertyTransfer Steps. This is what they do:
- PropertySteps:
Stores Properties for later use. In our case it's the Username and Password required to login. - Test Requests:
The actual requests to the server. In this case login and logout. - PropertyTransfers:
A step used for moving properties between different steps. This might be from a Property Step to a request like the step Property Transfer: Move Username and Password does, or to move properties from a Test Request to another, like the step Property Transfer: Move sessionID does.
- PropertySteps:
- Double click on the TestStep Property Transfer: Move Username and Password.
- The TestStep Editor will now open on the SoapUI desktop.

Concept: this property transfer does two transfers in two Properties. First it takes does the TransferUser Transfer. It takes the Property Username from the step Properties: Username and Password and moves it to the step Test Request: login. Then it takes does the TransferPass Transfer. It takes the Property Password from the said step Properties: Username and Password and also moves it to the step Test Request: login. - An important feature in SoapUI Tests is The Assertions. Assertions are made in Test Requests and is for validating that the response is what we expected. Open the Test Step Test Request: logout.
- In the TestStep we have four assertions, asserting different things;
- SOAP Response
That the response is a SOAP response - Schema Compliance
That it complies with the Schema - Not SOAP Fault
That is isn't a SOAP fault - XPATH Match
And something called an XPATH match. The XPath Match validates that a certain element has the value expected.
- SOAP Response
The Test Run
Now that we have examined the TestCase, let's run it! Press the Play Button and the Test will run and the Test Case progress bar should be full and green.
Does it turn red after only a step?
Don't forget to start the MockService.
Or... did you run the TestStep earlier?
Look at the response, maybe the response is that you already have a session?
We logged in earlier and aren't allowed to log in again, let's just go to the MockService, stop it and restart it, clearing any server side sessions. Now, rerun the test.





