API Testing Approaches and Tools: Postman, Rest Assured, jMeter, and more

What is API testing?

API in terms of the three-tier architecture

The role of API in the three-tier architecture

Why API testing is important

Three layers of the test automation pyramid

Types of API tests: aspects of focus

Functional API tests

  • returns the desired output for a given input;
  • handles errors when the results are outside of the expected parameters.

API performance tests

API security tests

  • What type of authentication is required to use the API;
  • How well sensitive data is encrypted;
  • What authorization checks are set for resource access, etc.

Integration and reliability tests of APIs

Integration API testing, Source: SoapUI

How to go about testing the API

API testing step by step, Source: Capital Terefe
  • the purpose of the API and its target consumer;
  • the workflow of the application;
  • the features and functions of the API;
  • other APIs this API interacts with;
  • aspects of testing;
  • the problems we’re testing for;
  • priorities in testing;
  • the desired output;
  • the definition of Pass and Fail.
  • testing value in response to the input condition: You define the input and authenticate the output, which can be any type of data or status (e.g. Pass or Fail);
  • checking the behavior of the API in the system when there is no return value in response;
  • tracking events or interruptions triggered by the output;
  • authenticating the effect on the system after data structure updates;
  • validating resources modified by the API call.

Tools for automated API testing: top choices

Postman client: testing of RESTful APIs using a JavaScript library

Verifying the status code to be 201 via Postman

Requests: human-friendly HTTP requests in Python

Testing the response time to be less than the timeout via Requests

REST Assured: a Java library supporting XML and JSON requests

REST Assured based test to check a GET API response, Source: Saurabh Agarwal

jMeter: a Java-based tool measuring SOAP/REST API performance and more

Using jMeter for testing, Source: Saurabh Agarwal

RestSharp: simple RESTful API testing in C#

API test using RestSharp: Check whether the HTTP GET call returns status code 200, Source: Bas

SoapUI: a functional testing tool for both REST and SOAP APIs

  • creating custom code (using Groovy) and complex scenarios;
  • testing asynchronously;
  • mimicking API before it’s implemented.

Katalon Studio: automation tool with inbuilt API testing mode

  • code auto-completion, inspection, and snippeting;
  • references and debugger;
  • inbuilt response viewer with auto-formatting;
  • search for access to artifacts;
  • tests importing from API testing and editing tools (e.g. Swagger, Postman, WSDL).
Katalon dashboard for testing API

API testing framework vs ready-made API testing tool

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store