Blogs-1

Introduction:

When trying to decipher RESTful APIs created by others or test ones you have built yourself, Postman is a fantastic tool. It provides a simple user interface for making HTML requests, reducing the need to write a lot of code only to evaluate an API’s operation. 

Testing is more efficient with Postman. Simply paste the path into the address bar, select the GET response method from the selection box to the left, enter your API key in the “Headers” area, specify “pretty” JSON as the return format, and hit submit. The response data will be in easy-to-read JSON format, with a status code of 200 indicating that the GET request was successful. That is all there is to it! 

Pre-requisite: 

You should be familiar with APIs, automation and manual testing. 

Installation

The Process of using Postman is quite simple and easy. Using Postman is a basic and straightforward process. The setup may be downloaded for all systems, including Windows, MacOS, and Linux, from its official website. Simply download and install the application on your machine, then begin testing the APIs. 

 It is simple to install in Linux and Ubuntu by typing the following command in the Terminal: 

$sudo snap install postman

Syntax 

As Postman is totally a GUI based Testing Tool, it does not have any specific Syntax to write/Test the APIs 

CRUD Operations 

CRUD stands for Create, Read, Update and Delete. There are four basic database operations that correspond to the most used HTTP verbs in Rest Services. 

Create [POST]:  

It is used to create a new resource but can also modify the underlying state of a system. 

Read [GET] 

It is used to retrieve a representation of resources. 

Update [PUT] 

It is used to Update an existing resource. 

Delete [DELETE] 

It Deletes the existing resource. 

Collection [API Automation]

To keep your workspace organized, engage with coworkers, develop API documentation and API tests, and automate request runs, you may arrange your Postman requests and examples into collections. To see a list of collections in a workspace, go to Collections in Postman’s left sidebar.  

  • It is quite easy to import or export a collection, which saves time when transferring requests. 
  • When you set a variable for a collection, it will also be applied to the folders that are created under that collection. 
  • It is simple to transmit data across collection requests. 
  • Using collection variables, data exchange between APIs is a breeze.  
  • There will be no need to build common test cases for distinct requests because tests written at the collection level will be relevant to all requests inside the collection.  
  • Using the collection runner, all requests can be executed at the same time.  
  • A CSV or excel file can be used to do data-driven testing.  
  • With the help of collection and Newman, continuous integration is simple. 

To run an automated test from a Collection, we can simply click on three dots on Collection Folder and Select the third option Run Collection, and it can perform all the test cases of CRUD Operations like create, put/patch, delete and get etc. Automatically. 

And in the next window, we can rearrange the order of the operation, and select the no. Of the iterations and the delay between each operation and can run all the operations inside the Collection. 

Once all the test cases run fine, it will give us the Status Code (Yellow), the time to execute the test case (Green), and the size of the tests for each operation (Pink). 

Pros 

  • It is User-friendly. Testers may quickly develop test suites by filling in templates using a simple interface. Postman also includes code samples for script construction, including examples of response time, response code, and other validations. 
  • Accessibility. Postman users may easily access their files by logging into their account on a device that has the Postman app, or the Postman browser extension installed. 
  • Various functionalities are available. All HTTP methods are supported by Postman, as well as saving progress, converting APIs to code, altering the API development environment, and many other features. 
  • Capabilities for tracking requests. Postman supports many status codes for HTTP responses, allowing users to check the response. To name a few, there are Successful requests, Empty responses, Bad requests, and Unauthorized access. 

Cons 

  • There is a limited amount of testing space. Postman is great for testing RESTful APIs, but it is not so great for SOAP APIs and other APIs. 
  • The reusability of scripts is limited. Users of Postman are unable to reuse or add more requests to their pre-written scripts. This means that testers will have to write fresh test scripts for each project. Integration that is restricted.
  • While APIs make the Agile process possible, the product itself has limited integration options. Connecting Postman to current systems and interacting across the team becomes a challenge.