0
0
Postmantesting~5 mins

Collection variables in Postman - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are Collection variables in Postman?
Collection variables are values stored at the collection level in Postman. They can be used across all requests within that collection to keep data consistent and reusable.
Click to reveal answer
intermediate
How do Collection variables differ from Environment variables in Postman?
Collection variables are specific to a collection and only available within it, while Environment variables are specific to an environment and can be used across multiple collections.
Click to reveal answer
beginner
How can you set a Collection variable in Postman?
You can set a Collection variable by opening the collection, going to the Variables tab, and adding a new variable name and value. You can also set it programmatically using scripts with pm.collectionVariables.set('variableName', 'value').
Click to reveal answer
intermediate
What happens if a variable name exists in both Collection and Environment variables?
Postman uses variable resolution priority. Collection variables override Environment variables if they share the same name when used inside that collection.
Click to reveal answer
beginner
Can Collection variables be used in pre-request scripts and tests?
Yes, Collection variables can be accessed and modified in pre-request scripts and test scripts using pm.collectionVariables.get('variableName') and pm.collectionVariables.set('variableName', 'value').
Click to reveal answer
Where are Collection variables stored in Postman?
AIn the Postman app settings
BGlobally across all environments
CInside a specific collection
DOnly in the current request
Which method sets a Collection variable in a Postman script?
Apm.environment.set()
Bpm.collectionVariables.set()
Cpm.globals.set()
Dpm.request.set()
If a variable exists in both Collection and Environment variables, which one is used inside the collection?
ACollection variable
BGlobal variable
CEnvironment variable
DRandomly chosen
Can Collection variables be used in test scripts?
ANo, only Environment variables can be used
BOnly if exported first
COnly in pre-request scripts
DYes, using pm.collectionVariables.get()
How do you add a new Collection variable in the Postman app?
AIn the Collection's Variables tab
BIn the Environment quick look panel
CIn the Global variables tab
DIn the request headers
Explain what Collection variables are and how they help in managing data in Postman collections.
Think about how you keep common data like API keys or URLs consistent in a group of requests.
You got /4 concepts.
    Describe the priority order Postman uses when resolving variables if the same name exists in Collection and Environment variables.
    Consider which variable Postman picks first when two variables share the same name.
    You got /4 concepts.