0
0
Postmantesting~5 mins

Generating dynamic data in Postman - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is dynamic data in API testing?
Dynamic data is information generated during test execution that changes each time, like random user names or timestamps, to simulate real-world scenarios.
Click to reveal answer
beginner
How can you generate a random email in Postman?
Use the built-in JavaScript function in the Pre-request Script tab, for example: `pm.variables.set('randomEmail', `user${Math.floor(Math.random()*10000)}@mail.com`);`
Click to reveal answer
beginner
Why use dynamic data instead of static data in tests?
Dynamic data helps avoid false positives by testing with varied inputs, making tests more realistic and catching issues that static data might miss.
Click to reveal answer
intermediate
What Postman feature helps to generate dynamic data easily?
Postman has a built-in library called Faker that can generate names, emails, addresses, and more using syntax like `{{$randomFirstName}}`.
Click to reveal answer
beginner
Show an example of setting a dynamic timestamp in Postman.
In Pre-request Script: `pm.variables.set('currentTimestamp', new Date().toISOString());` This sets a variable with the current date and time in ISO format.
Click to reveal answer
Which Postman feature allows you to generate random user names easily?
AEnvironment variables only
BFaker library
CManual input
DStatic variables
Why is dynamic data important in API testing?
AIt helps test with varied inputs to catch more bugs
BIt reduces the number of tests needed
CIt makes tests faster
DIt always uses the same data
How do you set a dynamic variable in Postman Pre-request Script?
Apm.environment.get('varName');
Bpm.response.to.have.status(200);
Cpm.request.send();
Dpm.variables.set('varName', value);
Which of these is NOT a way to generate dynamic data in Postman?
AHardcoding values in the request body
BUsing JavaScript in Pre-request Script
CUsing Faker syntax like {{$randomEmail}}
DUsing environment variables with dynamic values
What does this Postman script do? `pm.variables.set('id', Math.floor(Math.random() * 1000));`
ASends a request with id 1000
BDeletes the variable 'id'
CSets a variable 'id' to a random number between 0 and 999
DCreates a static id variable
Explain how to generate and use dynamic data in Postman for API testing.
Think about how you prepare data before sending a request.
You got /4 concepts.
    Why is generating dynamic data beneficial for test reliability and coverage?
    Consider how changing inputs affect test outcomes.
    You got /4 concepts.