Thursday, May 23, 2024

API Testing Using Postman: Part 2

  •  API helps to communicate between two different applications and also which are coded in 2 different languages.
  • For example, Google developed maps that contain open-source APIs. Maps are not only used by Google but also by different applications such as whatsapp, FB, snap etc.

  • API vs Webservice: API is a request which will be developed offline without using of public server and Webservice is also an API but it is deployed in the server and made available for the public.
  • All Webservices are API but all APIs are not Webservices.
  • An API is called a Webservice when an API is deployed in a public server and makes it available for everyone.
Two Types of API:
  1. Simple Object Access Protocol(SOAP). (XML format)
  2. REST(Representational State Transfer). (JSON, XML, etc.)
  • SOAP is a very old tool and it is difficult to understand the request and response sometimes.
  • Currently, we are using REST services. we have 4 major commands to request or to get the response.
  1. GET - used to get the requested info from the Database.
  2. POST - used to create a new item in DB.
  3. PUT - used to update the existing item in DB.
  4. DELETE - used to delete existing items from DB.


Friday, May 17, 2024

API Testing Using Postman: Part 1

Client and Server: The client is a computer or local machine which is from the user's end and the server is a place where the data is stored.



Client and server are divided into 3 categories.
  • 1-Tier -  It has only 1 client and 1 server.
  • 2-Tier -  It has multiple clients but contains only one server.
  • 3-Tier -  It will have 3 layers.
           Client(Presentation layer)[multiple clients]
           Business logic(Application layer)[multiple API's]
           Server(Data layer)[Multiple servers]



API - Application Programming Interface.
  •  Application - It works for a Web Application. It is called an Application Layer.
  • Programming - we will send API requests through code which are written in programming languages(Eg: java, python etc.).
  • Interface - It will act as an interface or communication barrier between client and server.


Uses of API Testing:
  • Generally, we test the UI using selenium and we check whether every functionality is working or not. But, when it comes to API Testing we send a request to the server based on the request it will give the response. In the response itself, we can check whether all the functionality is working or not. 80% of the Testing is completed within less time if you know API Testing and 20% will be testing the UI elements, colour buttons etc.
  • No need for UI Testing by 100%.If we perform API Testing.
  • We can perform API Testing once the backend code and the APIs are ready. A gap will occur between the presentation and Application layer(it will take time to create UI). In that time, we can test our application using API's. 
  • API Testing is simple and easy to learn compared to Selenium web application Testing.