The Talent500 Blog
postman

Postman: The Essential API Testing Tool for Beginners

In the ever-changing world of software development, there’s one tool that’s always been the top choice for testing APIs: Postman. Even with new tools and tech coming up, Postman remains the best for efficient, reliable, and complete API testing.

In this blog, we’ll see why Postman is still the most popular tool for API testing. We’ll look at its strong features, easy-to-use interface, big community support, and how it keeps getting better. Whether you’re a pro developer or new to API testing, let’s explore why Postman is so important in today’s software world.

How to Install Postman

To install Postman, visit https://www.postman.com/downloads/ . Choose Windows installer if you are working with Windows or Mac Installer if you’re working with Mac. Click on the installer file and follow the steps to install Postman on your machine.

Setup for first time use

Once you are done installing Postman, you can open the Postman app and you’ll encounter something like below.

If you want to store your requests and not have to worry about messy backups on your machine, you can choose to create your own account. This will ensure you have your data accessible even when you switch devices. Click on Sign In and choose the option Create Account. Please note, your local data will be wiped clean once you’re decided to log out.

Starting with your Workspace

Once you’re logged in/signed up, you getcan see your workbench. Workbench is a place to parse and tinker with your APIs JSON or XML requests.

As is evident in the screenshot above, my old collections are restored in my Postman app once I’ve signed in. This workbench can be accessed across your team and fosters greater collaboration. Below constituents that help you navigate Postman.

  1. Header: It has the settings for Postman, your workbench, an option called API Explore among others.
  1. The Left Sidebar: The left sidebar looks something resembling the one below. It consists of options like Collection, APIs, Environment to run the API and Mock Servers among others.
  1. Right Sidebar: This has an icon named code. This generates a curl request for the API you have hit and consists of all the parameters provided by the user (like headers, request, body, the kind of auth, etc).
  1. Footer: The bar at the bottom that consists of Proxy, Cookies and Trash among others.

Collections in Postman

Collection is a folder that stores a group of related APIs. Let’s have a look on the Login page. Below are the flows that are triggered from Login page:

  •   Login Success: The username and password are correct, and the user is logged in successfully.
  •   Forgot Password that takes the user to the password reset page.
  •   Forgot User ID: Another scenario that goes to the same flow mentioned above.
  •   Sign-Up: This has the fields required to create an account

Instead of keeping the request/response separately, it is easier to club them together and store them as a Collection. Now, if your test cases cover the positive and negative scenarios, collection helps the user to execute all the APIs in your collection by a single click and one after another. This in turn, reduces the time and effort as compared to hitting the APIs one after another.

History in Postman: What does it do?

The history option is located on the left sidebar. When you are logged in to Postman with your account, history keeps a record of all the API executions performed. The URL, request body, header values, etc are available when you click on the history icon.

How to save API response?

There are instances where you must send an API response across the team. Postman has an option to save the JSON response. Just click on Save as an Example to store the response of a given request in Postman.

What’s more, you can directly save the response to a file itself. This eliminates the hassle for copy and paste and generates a JSON file from the response. Click the icon beside the Save as an example option and you will get a pop asking you to confirm. You can rename the file and click on Save.

Environment and Global Values: A snapshot

The next 2 features mentioned are invaluable in reducing the hassle involved in keeping a track of Base URL or endpoint.

When you work with APIs, it’s highly likely that you have come across different environments like Dev, SIT, Preprod and Production having different values associated with it. For example, the SIT and Prod environment maybe having different URLs; something like this:

SIT: https:125.22.85.93/api/users?page=2

Prod: https:137.22.51.14/api/users?page=2

In the example mentioned above, it is evident that both the environments use the same service i.e. /api/users?page=2. It’s the server hosting those APIs that are different. When dealing with a few API’s it’s easier to manage. However, when the number of features of the product increases, it’s close to impossible to ensure all the requests are having the correct values. Thus, the need for an Environment variable. Once you assign the value to the Environment variable, it becomes quite easier to keep a track of the environment in use. Below is an example which demonstrates this:

In the top right corner, there is an option named Environment Quick Look. Clicking on that opens the details pertaining to the said environment. Click on the Add option and proceed to the screen below to save the details:

Replace the base URL with the variable and voila! The headache of managing SIT URL is put to rest.

Why use Variables then?

Well, let’s consider the previous example. It’s evident that the endpoint will be used in SIT as well as Prod. Maybe Dev and Preprod folks are also using the same. Then, it does make sense to create a variable that can be used across all the different variables.

Conclusion

In the recent world of software development, Postman is the top choice for testing APIs. It’s the go to tool for testers and developers because it’s easy to use, has great features, and lots of people to help you out. Postman makes testing simple, letting you create, run, and organise tests with ease.

From its easy installation process to its handy features like collections, history tracking, and environment management, Postman streamlines the API testing journey, allowing testers to ensure the quality and reliability of their APIs with ease. As we navigate the complexities of software testing, Postman remains an invaluable asset, empowering testers to validate APIs confidently and effectively.

0

Add comment