Tools for API Testing & Debugging – Part 1

Before jumping directly to API tools, let us first understand the basic concept of API.

Introduction of API

What is an API ?

API = Application Programming Interface

An API is generally a function that performs a server side logic or extracts information from databases. So, like a function call you need to give some inputs to an API. These inputs are called “Request Object” and the output of the API is called “Response Object”.

A Basic Example

When you google translate a string from Spanish to English, as soon as you type in the word / sentence, browser calls an API for translation.

your request object seems like …

{ “lang”: “sp”, “text”: “Todo lo mejor”, “outputlang”: “en” }

And the API output looks like …

{ “transtext”: “All the best” }

If you create an API, you may need to test it in different scenarios. You will not always have a front-end project consuming your APIs. Therefore, you may need some tools to test your APIs independently.

Tools for API Testing

tools for api testing
Chrome & Other Browsers

Web browsers themselves are the most basic tools for API testing and debugging. Almost all the web browser provide you a “Network” tab in their developer tools, where you can inspect all the API calls.

  • You can filter your API requests based on the request type. For Example, XMLHttpRequest, Media request, CSS request, etc.
  • You can read the API response
  • You can monitor what part of the API took most of the time, so that you can improve your API logic or server configurations accordingly.
Postman

Postman is an API testing tool that can be added as a browser plugin OR you can install it as a software (on Windows, Mac OR Linux)

So, let us see what you can do with the help of Postman, You can …

  • Create collections of your APIs
  • Create dummy servers for testing
  • Set environment variables
  • Schedule your API testing process
Swagger

If you are working in a team or in an enterprise based project, Swagger is really helpful for …

  • Creating API documentation
  • Testing APIs
  • Sharing APIs with your team members as well as to your consumers

To use Swagger in your own project, you only need to create a JSON or YAML file having a listing of your project APIs, The swagger will then automatically create a UI for testing the APIs, it can also create client libraries for those APIs automatically.

Currently, Swagger supports over 40 languages.

Request Catchers & Mock Response Generators

Request Catchers are online tools that provide you an endpoint (a URL). You can use this URL for testing purpose by sending HTTP requests to this URL. Then, On the Request catcher’s platform you can see the request object. If the request object is too big to understand, you can use tools like JSON Editor Online to create a collapsible JSON tree.

There are many free request catcher platforms out there, For Example :

Some of these platforms also provide facility to create a mock response (i.e. RequestBin)

Which are your favourite tools for API testing ?
Let us know in the comments below !!

Previous Post
Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *