Recall & Review
beginner
What is a global variable in Postman?
A global variable in Postman is a value stored that can be accessed by any request or script within the Postman workspace. It helps share data across multiple requests.
Click to reveal answer
beginner
How do you set a global variable in a Postman test script?
You use
pm.globals.set('variableName', 'value') to create or update a global variable in Postman.Click to reveal answer
beginner
How can you retrieve a global variable's value in Postman scripts?
Use
pm.globals.get('variableName') to get the value of a global variable in Postman scripts.Click to reveal answer
intermediate
What is the difference between global variables and environment variables in Postman?
Global variables are accessible across all environments and requests, while environment variables are specific to a selected environment and help manage different setups like dev, test, or prod.
Click to reveal answer
intermediate
Why should you be careful when using global variables in Postman?
Because global variables are shared across all requests and environments, accidental changes can affect many tests. It's best to use them only when needed and clean up after tests.
Click to reveal answer
Which Postman method sets a global variable?
✗ Incorrect
pm.globals.set() is used to set global variables accessible across all requests.
How do you access a global variable's value in Postman?
✗ Incorrect
pm.globals.get() retrieves the value of a global variable.
What is a key difference between global and environment variables in Postman?
✗ Incorrect
Global variables are accessible everywhere; environment variables depend on the selected environment.
Why might overusing global variables be risky in Postman?
✗ Incorrect
Because global variables affect all tests, accidental changes can cause failures.
Which of these is NOT a valid way to clear a global variable in Postman?
✗ Incorrect
pm.globals.remove() is not a valid method; use unset() or clear() instead.
Explain what global variables are in Postman and how they differ from environment variables.
Think about scope and sharing of variables.
You got /4 concepts.
Describe how to set, get, and clear a global variable in Postman scripts.
Focus on the Postman scripting API methods.
You got /4 concepts.