0
0
Postmantesting~5 mins

Local variables in Postman - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are local variables in Postman?
Local variables in Postman are variables that exist only during the execution of a single request or script. They are temporary and get deleted after the request finishes.
Click to reveal answer
beginner
How do local variables differ from environment variables in Postman?
Local variables last only during one request execution, while environment variables persist across multiple requests and collections until changed or deleted.
Click to reveal answer
beginner
How do you set a local variable in a Postman test script?
Use `pm.variables.set('variableName', 'value')` inside the script to create or update a local variable.
Click to reveal answer
beginner
How do you get the value of a local variable in Postman?
Use `pm.variables.get('variableName')` to retrieve the value of a local variable during the request execution.
Click to reveal answer
beginner
Why use local variables instead of environment variables in Postman?
Local variables are useful for temporary data that only matters during one request, avoiding clutter or accidental reuse in other requests.
Click to reveal answer
Which Postman method sets a local variable?
Apm.environment.set()
Bpm.collectionVariables.set()
Cpm.globals.set()
Dpm.variables.set()
How long do local variables last in Postman?
AUntil manually deleted
BOnly during the current request execution
CUntil the environment is cleared
DForever across all requests
Which method retrieves a local variable's value in Postman?
Apm.globals.get()
Bpm.environment.get()
Cpm.variables.get()
Dpm.collectionVariables.get()
Why might you prefer local variables over environment variables?
AThey avoid clutter by being temporary
BThey are easier to share
CThey are stored permanently
DThey persist across requests
Which of these is NOT a scope for variables in Postman?
ASession variables
BEnvironment variables
CLocal variables
DGlobal variables
Explain what local variables are in Postman and how to use them in a test script.
Think about variables that only live during one request.
You got /4 concepts.
    Compare local variables and environment variables in Postman. When would you use each?
    Consider how long you want the variable to last.
    You got /4 concepts.