Recall & Review
beginner
What is the main purpose of a pre-request script in Postman?
A pre-request script runs before the API request to prepare or modify data needed for the request, like setting variables or generating tokens.
Click to reveal answer
beginner
How do pre-request scripts help in dynamic data handling?
They allow you to create or update data like timestamps, random values, or authentication tokens right before sending the request, making tests flexible and realistic.
Click to reveal answer
intermediate
Why is preparing data in pre-request scripts better than hardcoding it in the request?
Because it avoids stale or repeated data, reduces manual updates, and supports automated, repeatable tests with fresh data every time.
Click to reveal answer
beginner
Give an example of data commonly prepared in a pre-request script.
Generating a current timestamp or creating a unique user ID to use in the request body or headers.
Click to reveal answer
intermediate
How do pre-request scripts improve test reliability?
By ensuring each request uses valid, up-to-date data, they reduce failures caused by outdated or missing information.
Click to reveal answer
What does a pre-request script in Postman do?
✗ Incorrect
Pre-request scripts run before the API request to prepare or modify data.
Why use pre-request scripts instead of hardcoding data?
✗ Incorrect
Pre-request scripts help avoid stale or repeated data by generating fresh data each time.
Which of these is a common use of pre-request scripts?
✗ Incorrect
Generating timestamps is a common task done in pre-request scripts.
When do pre-request scripts run in Postman?
✗ Incorrect
Pre-request scripts run before sending the API request.
How do pre-request scripts improve test automation?
✗ Incorrect
They prepare fresh data automatically, making tests repeatable and reliable.
Explain why pre-request scripts are important for preparing data in Postman.
Think about what happens before sending an API request.
You got /4 concepts.
Describe a real-life example where pre-request scripts help in API testing.
Imagine you need fresh data every time you test.
You got /4 concepts.