API Testing

In my previous blog, I explained what API is. I will delve deep into the importance of testing the API in this blog. While most testing focuses on the UI, which is crucial, it is equally important to test APIs from the initial stages of the software development.

The purpose of API testing is to make sure the interface between two applications is working smoothly without any interruptions.

Let me take an example to explain. Seetha tells her mother Latha, that she wants a new pair of shoes for her school. Because it is raining outside and they cannot go shopping directly, Latha decides to buy the shoes online using a mobile application to shop at the “ABC” store.


In this example,

  • Latha is the client who sends the request by searching for specific shoe requirements.
  • The mobile application is the API that gets the request from the client and waits for the response from the server and again it sends back the response to Latha
  • The “ABC” store is the server that sends the response based on the input provided by Latha through the mobile application.

API Testing in this Scenario:

  • Searching for a pair of shoes:
    • API Request: Latha selects a shoe, and the app sends your order details to the store to check the availability.
    • Testing Example: Check if the API correctly tells the store what kind of shoe Latha ordered, including size, color, and other instructions.
  • Receiving Confirmation:

    • API Response: The store confirms that they received Latha’s order and provides an estimated delivery time.
    • Testing Example: Verify that the app displays the confirmation back to Latha and shows you the right information on her mobile app.
  • Handling Errors:

    • API Error Handling: If the store is out of a particular size and color, the API needs to tell the app to let her know.
    • Testing Example: Ensure that if the store can’t fulfill the order as requested, the mobile app communicates properly to Latha that the “Size 7 is not available right now”.

  • Why API Testing is Important:

    • Accuracy: Ensures that the right information is exchanged between Latha and the store via mobile app.
    • Reliability: Makes sure that even if something goes wrong, like an item being out of stock, the system handles it gracefully.
    • Security: Verifies that sensitive information, like the client’s personal details, is handled safely.
    • Performance: Check if the response times are fast enough to provide a good user experience.

Comments

Popular posts from this blog

How to Install Jenkins

HTTP Payloads

Variables in Postman