MadCode Meetup: How to test Web API using SoapUI

July 7, 2015

On July 1 we conducted our 7th MadCode Meetup. It’s free monthly webinar where members of our team share their knowledges in some specific area of mobile development. This time Oleg Nikiforov, QA Engineer at Stanfy talked about testing of Web API using SoapUI, particularly about:

  • why do we need to test Web API if developing mobile applications;
  • how SoapUI can help us in testing of Web API;
  • things we can test in Web API.

In this article he also shares live demo of SoapUI in action. So let’s dive into the learning!

What is a server API?

A server-side API is a programmatic interface to a defined request-response message system, usually expressed in JSON or XML, which can be used by web, mobile or other applications that work with back-end.

Usually, while working on mobile applications, you deal with RESTful systems, which utilize the same HTTP verbs (GET, POST, PUT,DELETE, etc.) used by web browsers to retrieve web pages and send data to remote servers:

  • GET /user – get user info.
  • POST /user – create new user.
  • PUT /user – update user profile.
  • DELETE /user – delete user.

Why do you need to make API tests?

  • Make sure that at least positive scenarios work and users are able to use your application: this is achieved by building test suites with sequences of test steps that simulate API calls made by your app.
  • Help developers: by knowing if the server is stable or not they can choose whether to do server related tasks or focus on other things.
  • API tests can serve you as a data source for your testing: you can easily get needed data from the backend (especially if you don’t have direct access to the database).
  • By creating API tests with different input data you can simulate how your app interacts with the backend and you will see what kind of server errors you are able to cause while using your mobile application.
  • With the help of different assertions you will be sure your app receives proper data and not some junk. 🙂

What is SoapUI?

SoapUI is a cross-platform Functional Testing solution that can be used for testing both servers and client applications.

Currently SoapUI offers both free and paid versions. The paid version is integrated into the Soap NG Pro app which offers a variety of tools. You can see a detailed comparison here.


Personally I prefer to use SoapUI for testing server API because it offers lots of useful features, such as:

  • Support for Groovy or JavaScript written scripts (in test steps, assertions, setup or teardown scripts, etc.).
  • Different kinds of assertions (both predefined and custom written).
  • Integration with CI tools.
  • Easy to share test data (credentials, endpoints, user data etc.) across a project and to external files.


To summarize, I’d like to call attention to several points:

  • Use any available tool for testing server API; you should be able to find one that suits you the best.
  • Think about assertions; it’s a key to writing useful tests.
  • Try to generate “real” data; you will need it later while testing your app.
  • Cooperate with developers; ask them what they expect from your tests.
  • Write API tests as early as necessary; there’s no need to cover all API at once.

If you’ve always wondered why you should test server API, well, try it and you’ll see benefits even to testing frontend.