Example REST Test in SoapUI

This tutorial walks you through how to perform a REST test in SoapUI. To make sure you get the most value out of this tutorial, please make sure you have the latest release of SoapUI downloaded.

Download SoapUI here

Why Use SoapUI for REST Testing?

While SoapUI Open Source can be seen as the Swiss Army knife for testing, SoapUI Pro is the tool with the sharpest edge. Applied to testing web services, SoapUI Pro focuses on enhancing efficiency and usability. With Point and Click Testing, you can drag and drop instead of manually writing the code. The Form Editor creates a form from your request, eliminating the need for you to spend time on repetitive coding. The Outline Editor simplifies and exposes the XML structure. These functions make your testing less time-consuming. If creativity, flow and speed are important to you as a tester, SoapUI Pro is for you.

REST Sample Project

Getting started with a new application is always a challenge, no matter how complex it is. In order to get started, SoapUI comes with a sample file that can be used as reference and inspiration.

Note: If you chose not to install tutorials when installing the product, you do not have the sample file. Use the SoapUI installer to update the existing installation and get access to the sample file.

The sample illustrates some of the basic concepts of SoapUI and can be used as a starting point. Try out the project, run the included mock service and tests to familiarize yourself with the SoapUI interface, and then move on to the Your First SoapUI Project tutorial.

An example of REST API Testing with SoapUI

Step1: Open MockService

1. Double click on MockService:

Start MockService

2. Click Run Mock Service to start the mockservice.

You will see mockservice "running on port 8080".

Running on port 8080


Configure MockService using MockService Option

Step2: REST Request TestCase

1. Expand the "Test account creation" and the nodes below until you reach View Forum. Double click it and you will see REST Request TestCase Viewer open:

Open Request

2. Click Submit request to send a request. You will see REST Test Response on the right.

REST Test Response


REST Request and Response View.

3. You can change the view of your request and response by clicking on figure13a_icon and figure13a_icon9.

Change layout

figure13a_icon - toggle to tab based layout

figure13a_icon9 - changes the orientation to request pane split

Step3: Adding Assertion

1. Click Assertions to open the assertions tab:

Open Assertion tab

2. Click Add to add a new assertion:

Adding a New assertion

3. Select the Contains assertion in the Add Assertion dialog:

Select the Contains assertion

4. Enter the content that the response message must contain:

Configure Contains assertion

5. You may run the test step by clicking Submit REST Request:

Passed Contains assertion