Testing with Postman: Variables

Search for a command to run...

No comments yet. Be the first to comment.
In this series I will cover testing with postman and using it for automation.
Since I talked about reusable code in your environmental variable last week lets see how that works this week. Adding Reusable Code to Your Variable //Here we create a function that is then stored in the environmental variable. This is so we can then...
I have spent the last few weeks adding AI agents to my Playwright framework. Specifically Playwright's planner, generator, and healer, running locally through Claude Code. The Playwright agents explor

I decided to do a dump or a one stop shop for learning postman. You can go through my other post or just read this one. Testing Basics So to get started with postman you will need your API url and whether it is a GET, POST, PUT, DELETE or various oth...

Next is to setup a DevOps job you can go here to learn how to do that. For this section we will focus on the Execute shell and newman. With this I suggest going through Postman's official documentation found here. This takes your postman game and ups...

Schema is something you need to test to make sure when they need a string that it is indeed a string. If you google postman and schema checking you will also find a cool tool called tv4. Do not use this as it is out dated and no longer supported. Ple...

Another javascript library built into Postman is Lodash. #Looping Arrays with Lodash Sometimes you will want to iterate through an array. Maybe your response itself is an array. Luckily there is an easy for loop that can be used. This is use for wher...

Sorry it has been a while but I recently moved job and house, so life has been hectic. Next we will discuss variables. There are a lot of different variables you can use like Collection, Environmental, path, and others. The main 2 I use are Environmental so that we can have different variables for Dev, QA, Prod and any other environments there maybe.
One thing I will go over later is reusable code. You can store code in an environmental variable.
Create an Environmental Variable for the project with the base URL as a variable called url. This allows us to use {{url}} in our calls so we can use the test one both containers.
url - http://www.example.com/api
Another trick is using the environmental variable for passing variables from one API call to the next. For example we have an Encryption API.
pm.environment.set("encrypted", pm.response.text()); //Sets the variable and allows us to call it later.
//In the other API we can now use the below as a variable.
{{encrypted}}
One thing you can do when setting up Parameters is store the value in the environmental variable. You can also do this with Path Variables. For example you can call example.com/:variable/. :variable is a path variable and as such you can set it to be an environmental variable or anything else. You are now allowed to change it just like you would a parameter.
Postman Quick Reference Guide Chai Assertion Library Regex Cheat Sheet Postman: The Complete Guide on Udemy