ProductivityAndFun Download Trial - Free 14 day evaluation

Web Service Sample Project - 3) Functional Tests of Web Services

PDF Print E-mail
User Rating:  / 238
Rate this article: PoorBest 

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
  • 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.

  1. Expand the Sample Simple TestSuite and double click on Simple Login and Logout w. Properties Steps.
    Simple TestCase in SoapUI
  2. As you can see the TestCase consist of five TestSteps.
    Five TestSteps in SoapUI
  3. You can also click the Description tab in order to see the in test documentation.
    TestCase Description Viewer
  4. 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.
  5. Double click on the TestStep Property Transfer: Move Username and Password.
    Simple TestCase in SoapUI
  6. The TestStep Editor will now open on the SoapUI desktop.
    Five TestSteps in SoapUI
    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.
  7. 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.
  8. 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.

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.


Go to Article Page: Go to Previous Page 1 2 3 4 5 Go to Next Page