Postman Environment Variables: API Testing using Postman - (Part 4)

preview_player
Показать описание
What is an Enviroment in Postman

An environment is a set of key-value pairs. The key represents the name of the variable. You can use a data editor to modify an environment.

While working with APIs, you often need different setups for your local machine, the development server, or the production API. Environments let you customize requests using variables so you can easily switch between different setups without changing your requests.

You don't need to remember all those values once they are in Postman. You can download environments, save them as JSON files, and upload them later.

You can create, share, duplicate, export, and delete an environment. You can also import an environment as a single JSON file.

Creating a new environment
You can create a new environment from the:

Manage Environments icon
New button
Launch screen

What is Variable?

Variables are symbolic names that represent the information you store in them. The information the variables represent can change, but the operations on the variable remain the same. Variables in Postman work the same way.

You can assign five types of variable scopes:

Global
Collection
Environment
Data
Local

Data variables
The Collection Runner lets you import a CSV or a JSON file, and then use the values from the data file inside HTTP requests and scripts. We call these 'data variables'.

To use them inside Postman, follow the same syntax as environment or global variables.

Data variables in requests
Variables inside the Postman UI are enclosed inside curly braces.

For example, in the screenshot below, {{username}} and {{password}} inside URL parameters would be replaced by corresponding values from the data file:

Dynamic variables
Postman has a few dynamic variables that you can use in your requests.

Dynamic variables cannot be used in the Sandbox. You can only use them in the {{..}} format in the request URL / headers / body.

{{$guid}} : Adds a v4 style guid

{{$timestamp}}: Adds the current timestamp

{{$randomInt}}: Adds a random integer between 0 and 1000

For a complete list of dynamic variables, refer to the section Dynamic Variables List.

🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅Selenium Training and Certification -

✅Learn Jenkins for QA -

✅Programming Java -

✅Test Automation -

✅API Testing -

✅Cypress Tutorial with LIVE Projects -
Рекомендации по теме
Комментарии
Автор

Thanks for the collection tutorials, it was good to have deep knowledge of several pieces of it

gundeepsingh
Автор

Very helpful, easy to understand. Thank you

RicardoDiaz
Автор

What if we try to define 2 global variables from Pre-Request script at the same time, will it give us the result

mangeshpardeshi
Автор

Thanks for providing the videos. Your explanation is awesome but only thing is unable to see the text clearly.

ujweyvv
Автор

how do you find out which API to check ? if it doesnt say API in the network setting of the chrome developers tools?

Zack-nivz
Автор

Thanks, The only problem is the quality of videos, I cannot read.

solmazgharagozloo
Автор

what happened to local variable var data = 2??

PinoyGuitarTutorials
Автор

I have confusion at 1:29 [ collection come under enviroment] or [enviroment come under collection] .

hansrajmaurya
Автор

If I have two different collections and two different environments, I want to connect the 1st collection with the 1st environment and the 2nd collection with the 2nd environment for all time. Is this possible?

fwpglui
Автор

mean sir scoop of environment variable is greatter than global variable thats whywe can use in different work space is this is correct?

finder
Автор

Very well explained Sir but video quality is not good .

maheshjare
Автор

When I am adding the value in current value and clicking on send the value vanishes and I am not able to get the response. Is there any way to save the values in particular environment?

Komalk
Автор

what is pre-request script ?
what is global variable ?
and why we use that i didn't get you properly.

rajendraacharya
Автор

Hi Pramod, Very useful video. But the video quality is not good. Cannot see properly.

harinivenkateshan
Автор

Hi promod,


Which is the language used in the test screen??? and
do we need to learn any programming language for automation using postman?


can you give your comments on these points?

hemanthgowda
Автор

How to use token without expiring where should we declare it, i have declared in environment variables still it gets expired so can you help me on this ?

pavithra
Автор

Very well explained. but there is 1 suggestion. you have used very small font size so it is difficult to understand.

poonambhondve
Автор

local vars leverage? seems like you skipped.

parthakonda
Автор

How to delete an added environment in Postman

fwpglui
Автор

Dude you are going to give people seizures with that intro

rw