Member-only story

Validating Responses in POSTMAN

Visakh Vijayan
4 min readDec 20, 2020

--

Testing is a big part of any development cycle. Of the many tools we use, Postman is perhaps one of the lesser-known beasts. Most of us just use the tool to send a request and see the response. There is a rather valuable part of the tool called Test which we will discuss today.

We will start by sending a POST request to {{url}}/user/profile. The {{url}} is my environmental variable which basically allows one to substitute a value to it globally.

We have a response on the right-hand side. The task now is we want to verify whether the keys in the JSON are as we expect them to be. For that, we will need something called a JSON schema. A schema is basically a blueprint of the response. You can relate to this by the “class as a blueprint of the object” example.

To make the schema we will go to https://jsonschema.net/home. Once you are logged in you will get a screen as below. All you have to do is paste your response on the left-hand side of the screen. Now click on submit. You will find a schema generated on the right-hand side.

What this basically means is you will create rules on how the response should be validated. We will get into the details…

--

--

Visakh Vijayan
Visakh Vijayan

Written by Visakh Vijayan

Techie from Kerala, India. Days are for coding, nights for weaving tales of tech, travel, and finance. Join me in exploring this multifaceted journey

No responses yet