Magento 2 Development Workshop Learn More

Manual QA in Magento 2 for Beginners

10 lessons

API Testing

One of the hardest and confusing parts of a testing guide. This type of testing is very important in every aspect of testing the product, site, app or else.

API Testing - is a type of software testing that involves testing application programming interface (APIs) directly and as part of integration testing to determine if they meet expectations for functionality, reliability, performance, and security.

For easier to understand, every client-server or client-server-client apps are connected with each other by API requests. These APIs can have their own response codes, parts of the request like header and body.

There are three types of output can be tested during the API testing: 1. Any type of data (it is like: attribute, attribute b etc.); 2. Status (say Pass or Fail); 3. Call another API function (this can have a couple of returns, return value based on input condition or update data structure).

There are a couple of tips about best practices of API testing:

  • Test cases should be grouped by test category
  • On top of each test, you should include the declarations of the APIs being called.
  • Parameters selection should be explicitly mentioned in the test case itself
  • Prioritize API function calls so that it will be easy for testers to test
  • Each test case should be as self-contained and independent of dependencies as possible
  • Avoid "test chaining" in your development
  • Special care must be taken while handling one-time call functions like - Delete, CloseWindow, etc...
  • Call sequencing should be performed and well planned
  • To ensure complete test coverage, create test cases for all possible input combinations of the API.

There are a lot of the solution apps that are used for API testing. Everyone is using that app that prefer:

  • Postman;
  • Insomnia;
  • Cfix;
  • Runscope.

I will show an example of the simple API requests with simple explanations what and how it should be performed:

image1

This guide is not a first you need to read about API testing, and you will know everything about it. It is like a general observation of what it is and how you as QA engineers need to perform it.