Postman Environment Variables: API Testing using Postman - (Part 4)
Вставка
- Опубліковано 17 сер 2019
- 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.
Join Facebook Group : Software Testing & Automation Discussion - bit.ly/askpramod
Blog : scrolltest.com
Follow at Quora : www.quora.com/profile/Promode-1
🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌
✅Selenium Training and Certification -
scrolltest.com/go/edureka
✅Learn Jenkins for QA -
bit.ly/learnjenkins-p1
✅Programming Java -
bit.ly/learnjava2020-p1
✅Test Automation -
bit.ly/learnautomation2020
✅API Testing -
www.learnapitesting.com
✅Cypress Tutorial with LIVE Projects -
cypresstutorial.com - Навчання та стиль
good bro its very helpful 1000+like
Thanks for the awesome feedback ❤️
Thanks for the collection tutorials, it was good to have deep knowledge of several pieces of it
Thanks a Gundeep,
Very helpful, easy to understand. Thank you
Thanks for the awesome feedback ❤️
Great resource thanks for sharing
Thankyou for your efforts.
Crisp and clean explanation
Thanks for the awesome feedback
@@TheTestingAcademy dude kindly improve quality of video.videos are informative but not visible
Thanks for providing the videos. Your explanation is awesome but only thing is unable to see the text clearly.
tq sir I learn more information
Thanks, The only problem is the quality of videos, I cannot read.
Very true,I tried watch the hd video but still it is still very light in colour.
Thank you!
Thanks for lovely comment, Please share with your friends or any one who you think may need it.
What if we try to define 2 global variables from Pre-Request script at the same time , will it give us the result
Very well explained Sir but video quality is not good .
how do you find out which API to check ? if it doesnt say API in the network setting of the chrome developers tools?
Hi Pramod, Very useful video. But the video quality is not good. Cannot see properly.
Sure will take care next time
helpful
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?
mean sir scoop of environment variable is greatter than global variable thats whywe can use in different work space is this is correct?
I have confusion at 1:29 [ collection come under enviroment] or [enviroment come under collection] .
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?
what happened to local variable var data = 2??
Very well explained. but there is 1 suggestion. you have used very small font size so it is difficult to understand.
Will take care next time Poonam
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?
To learn postman, you don't need to learn any language, but basics of Javascript helps in creating testcaaes
@@TheTestingAcademy ok for automation testing...same JavaScript language is required??
what is pre-request script ?
what is global variable ?
and why we use that i didn't get you properly.
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 ?
Globally
local vars leverage? seems like you skipped.
Added to next video : )
@@TheTestingAcademy Great. Thanks.
How to delete an added environment in Postman
There is option to delete ir
Dude you are going to give people seizures with that intro
This is removed in new vidoes 😂
I almost had a seizure with that intro
Haha, thanks