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?
✗ Incorrect
pm.variables.set() sets a local variable that lasts only during the current request execution.
How long do local variables last in Postman?
✗ Incorrect
Local variables exist only during the current request execution and are deleted afterward.
Which method retrieves a local variable's value in Postman?
✗ Incorrect
pm.variables.get() retrieves the value of a local variable during the request execution.
Why might you prefer local variables over environment variables?
✗ Incorrect
Local variables are temporary and help avoid clutter by not persisting beyond the current request.
Which of these is NOT a scope for variables in Postman?
✗ Incorrect
Postman does not have 'session variables' as a scope; it uses local, environment, global, and collection 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.