API Testing Tutorial Part 2 – Why is API Testing Important?

Hello Folks,

In this post, we will learn why we should do API testing.

At a very high level, an application has three components:

  1. Back end (Data Layer) : Where data is stored and retrieved.
  2. Front end (Presentation Layer) :  User interface.
  3. Middle ware (Logic Layer) : It connects front end and back end of application.

Let’s understand above point with an example:

You must have heard about Gmail. If you want to create an email id, you visit to Signup page of Gmail where you provide all details like name, age, mobile number etc. You provided details using Front end or presentation layer of Gmail application. Once you enter all details and submit, An API creates a request with data provided by you and hits an end point which creates a new user and stores information to a specific table of database. This API is middle ware. Data provided by end user and credentials details are stored in database. This is back end. You can see how all layers are interconnected using middle ware i.e. API.

As per current development process, maximum functionalities are exposed/built as an API. For example: Consider a hospital application. This application provides below functionalities:

  1. Register a patient.
  2. Login to patient dashboard.
  3. Logout from patient dashboard.
  4. Retrieve list of patients.
  5. Delete a patient record.
  6. Book an appointment.

 

Developers will develop all these functionalities as APIs which will be integrated by back end and front end teams. When development of application is completed, you start testing. You launch applications front end and provide details to register a patient and find patient is not registered or wrong data is shown or something else.  Wow!! You found many defects. Now you will raise them and will be fixed by developers. Front end and back end team will also make some or more changes and once deployed you will test again using UI. It took lot of time, effort and Money.  Actually you could have found this defects at very early stage and saved a lot of time, effort and cost. This can be done using API testing.

An API for “Register a patient” will have logic to register a patient and all types of error or warnings if something goes wrong. You can test status, speed and data accuracy of an API independently. Suppose, you need to test “Register a patient” for a different sets of data. You need to keep entering data through front end and you can not cover all those. But API testing makes it easy for you as you don’t require an UI to test API.

You can start early testing and find major bugs at early stage. It will save a lot of time and defects will not move from back end and middle ware to front end. It will increase your application stability and performance.

API testing is beneficial as smoke testing as well. You can quickly check whether all APIs are up and responding quickly and providing correct information. An automated API testing is more powerful.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyAPITesting

13 thoughts on “API Testing Tutorial Part 2 – Why is API Testing Important?

  1. Started reading your post liked it the way you have explained(with examples).

    Great work…!!!

  2. Do application are developed to communicate internally also via API. Most of it is via function calling i believe. API are mostly used for external communication. A product is developed with all the internal things to be called via methods.

    Correct me if am wrong. As writing an API for all internal logic like login/logout will take more time.

  3. Hi amod……ur post are superb.
    pls post in detail about API testing means how to do API Testing, which tools are used.

Leave a Reply

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