Redsauce's Software QA Blog

Postman: a quick guide for beginners

Posted by Isabel Arnaiz

{1570}

How to use Postman?

  • Registration: Create your Postman account and login to the initial dashboard.

  • Workspace: Create workspaces, organize collections, APIs and variables.

  • Make requests: Make a new request. Save and send.

  • Collections: Group related requests and execute them sequentially.

  • Console: Debug and display details of requests.

  • Tests: In the Test tab, execute JavaScript code to evaluate responses.


You may have noticed that Postman has positioned itself as the all-in-one testing tool for API services in recent times. This is mainly because its intuitive and user-friendly interface allows you to group all possible actions of the API-first strategy in a single platform. In this environment, you can describe, evaluate, document, and monitor an API service in a sustainable and scalable manner, with added facilities for teamwork.


Do you want to include Postman in your set of skills acquired as a QA Tester?


Then stay tuned: we'll start with our beginner's guide to using this tool.

Step 1: Create your Postman account and join the community

Once you register and access your Postman account, you will find an initial dashboard similar to the one below, where you usually have direct access to your workspaces, a history of your activity, as well as the most recent updates and deployments to Postman.


Postman first page

Postman Workspace

The workspace is one of the strengths of working with Postman, as it allows you to organize collections, APIs, environment variables, monitors, and other elements of the same project, as well as share them with other members of your team.


To create a new workspace, you expand the menu Workspaces> Create Workspace, enter a name for your workspace and define who will have access to it.


Once the workspace is created, you can find an action bar on the left to navigate between the different elements that make up your workspace. If you press the more options iconShow more options icon postman, you can also identify the possible tasks for each of the elements.


And now, here's the question: How do you make requests in Postman to connect with a specific API service?


Simple! Create a request by clicking the new request icon New request postman icon and defining the verb, service address, headers, and body of the request. Before clicking the Send button to execute the request, make sure to save its configuration.

Step 2: Postman Requests

Create a new request in your newly created workspace as shown in the image below. For this example, we used the free JSON Placeholder test API available at this address.


First postman request


Execute the request.


Congratulations! You have made your first request to an API with the help of Postman.


Now let's add two more requests.


2 more requests on postman


Note that you must set the id parameter in the first request, as well as the request body for the second, as shown in the following images. Run them.


Second postman request


Third request on postman


If you received HTTP 200 and 201 status codes for each respective response, then you have successfully completed these last two examples.


Let's move on to the next level!

Postman Collections

As you can see, making requests to a service with Postman is really simple. However, and although in the previous example we make a random request to the service, in daily practice it is better to create a collection of requests. In them, you can group the different actions that you need to survey from the service and even create more than one collection within your workspace if you want to build different scenarios to survey or evaluate the service's functionalities.


If you also work on a project with more than one deployed service, having a collection for each of them is even more appropriate. This not only maintains an organized and easy-to-document structure, but also allows other members of your team to work in parallel on the project.


IMPORTANT - In Postman, collections do not only group requests but can also be a workflow or a set of tests. We will be addressing all of this in greater depth in future posts.

How to organize and run my collections in Postman?

Requests in a collection can be grouped into folders, with the execution hierarchy defined by the order of appearance of the requests in the folder structure.


Folder structure on postman


In Postman, sequentially running the requests is possible with the help of the Collection Runner. This is a manual execution alternative that can be accessed either through the options menu of each collection or directly in the bottom bar of your workspace.


Runner access on postman


Initially, the execution of the requests in a collection in the Collection Runner corresponds to the sequence in which they are located within the collection. However, the sequence order can be modified prior to each execution by repositioning the requests with just a drag and drop.


Runner view on postman

Step 3: Sequentially run a collection of requests

Click the Run JsonPlaceholder Example button and observe the sequential execution of each request.

The Console in Postman

A tool that we can't overlook in this basic introduction to Postman is the Postman Console. This console embedded in the Postman desktop allows you to debug a collection of requests or APIs, as well as API tests that are not behaving as expected. Essentially, it's similar to the browser version of the developer console, except that it's tailored for API development. Every time a request is executed, the Postman Console displays the exact path of the request along with its headers, network information, and payloads.


With the Postman Console, you can also display messages or values of variables that you have defined in your scripts and pre-request scripts, as well as global or environment variables.


console.log("nameOfVar", valueOfVar);

You can even take advantage of the info, warning, and error methods to add style to your message. Let's try it out!

Step 4: Perform a test in the Postman console


Open the Test tab in the first request you ran. In this area, you can execute code in JavaScript. Copy the following code snippet there:


var statusResponse = pm.response.status;


if (statusResponse === "OK"){

console.info("statusResponse", statusResponse);

}else {

console.error("statusResponse is not OK");

}

Now, execute the request and you will see how not only the path of the request appears in the console but also the message corresponding to its status.

Postman is waiting for you!


As you have seen, Postman is an easy-to-use and very useful tool during the process of conceptualizing, developing, and evaluating an API.


If you have completed each of the steps in this tutorial, you are undoubtedly ready to take your first steps in Postman.


On the other hand, if you or your team need help with your API tests, at Redsauce we specialize in automating them and integrating them into the development pipelines. You can learn more at this link.


This is the first post in a series of publications about Postman that will help you continue to delve into and master the functionalities of this powerful tool. Subscribe to our blog, you'll be the first to know!


Download free QA ebook

About us

You have reached the blog of Redsauce, a team of experts in QA and software development. Here we will talk about agile testing, automation, cybersecurity… Welcome!