Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
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
✗ Incorrect
The Faker library in Postman provides many random data generators like user names.
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
✗ Incorrect
Dynamic data tests with different inputs each time, helping find bugs missed by static 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);
✗ Incorrect
Use pm.variables.set() to create or update a variable dynamically before the request.
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
✗ Incorrect
Hardcoding values is static data, not dynamic data generation.
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
✗ Incorrect
It generates a random number from 0 to 999 and stores it in variable 'id'.
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.
Practice
(1/5)
1. What is the main purpose of generating dynamic data in Postman tests?
easy
A. To hardcode fixed values for all requests
B. To slow down the test execution
C. To make tests flexible and simulate real user input
D. To avoid using any variables in tests
Solution
Step 1: Understand dynamic data role
Dynamic data allows tests to use different values each time, simulating real users.
Step 2: Compare options
Only To make tests flexible and simulate real user input describes making tests flexible and realistic, which is the main goal.
Final Answer:
To make tests flexible and simulate real user input -> Option C
Quick Check:
Dynamic data = flexible, realistic tests [OK]
Hint: Dynamic data means changing values to mimic real users [OK]
Common Mistakes:
Thinking dynamic data slows tests
Confusing dynamic data with fixed values
Ignoring the need for variable data
2. Which of the following is the correct syntax to generate a random integer between 1 and 100 in Postman using dynamic variables?
easy
A. {{random.integer(1,100)}}
B. {{randomInteger(1,100)}}
C. {{randomInt(1,100)}}
D. {{random.int(1,100)}}
Solution
Step 1: Recall Postman random integer syntax
Postman uses {{random.int(min,max)}} to generate random integers.
Step 2: Check each option
Only {{random.int(1,100)}} matches the correct syntax exactly.
Final Answer:
{{random.int(1,100)}} -> Option D
Quick Check:
Correct syntax = {{random.int(min,max)}} [OK]
Hint: Use {{random.int(min,max)}} for random integers [OK]
Common Mistakes:
Using wrong function names like randomInt or randomInteger
Using dot instead of function call syntax
Missing parentheses or curly braces
3. What will be the output of the following Postman dynamic variable in a request body?
{"userId": "{{random.uuid}}"}
medium
A. {"userId": "a unique UUID string generated at runtime"}
B. {"userId": "random.uuid"} (literal string, no substitution)
C. {"userId": "123e4567-e89b-12d3-a456-426614174000"} (a fixed UUID)
D. {"userId": "{{random.uuid}}"} (variable not replaced)
Solution
Step 1: Understand {{random.uuid}} behavior
This variable generates a unique UUID string each time the request runs.
Step 2: Analyze output options
{"userId": "a unique UUID string generated at runtime"} correctly describes a unique UUID generated at runtime, not a fixed or literal string.
Final Answer:
{"userId": "a unique UUID string generated at runtime"} -> Option A
Quick Check:
{{random.uuid}} = unique UUID string [OK]
Hint: {{random.uuid}} always creates a new unique ID [OK]
Common Mistakes:
Expecting a fixed UUID value
Thinking variable is not replaced
Confusing with literal string output
4. You wrote {{random.int(10,5)}} in your Postman test to generate a random number between 10 and 5. What is the issue and how to fix it?
medium
A. No issue, it works fine as is
B. The min and max values are reversed; swap them to {{random.int(5,10)}}
C. Use {{random.integer(5,10)}} instead for correct syntax
D. Remove parentheses: {{random.int 5,10}}
Solution
Step 1: Identify parameter order requirement
Postman expects the first argument as min and second as max; min must be less than max.
Step 2: Fix reversed values
Swapping 10 and 5 to {{random.int(5,10)}} corrects the range.
Final Answer:
The min and max values are reversed; swap them to {{random.int(5,10)}} -> Option B
Quick Check:
Min must be less than max in {{random.int(min,max)}} [OK]
Hint: Min value must be less than max in random.int() [OK]
Common Mistakes:
Using reversed min and max values
Incorrect function name random.integer
Removing parentheses causing syntax errors
5. You want to generate a dynamic email address in Postman that always uses a random username but a fixed domain @example.com. Which of the following is the best way to do this?
hard
A. {{random.username}}@example.com
B. {{random.email}}
C. {{random.username}}@{{random.domain}}
D. {{random.email}}@example.com
Solution
Step 1: Understand requirement
The username should be random, but domain fixed as '@example.com'.
Step 2: Evaluate options
{{random.username}}@example.com concatenates a random username with fixed domain correctly. {{random.email}} uses full random email (domain varies). {{random.username}}@{{random.domain}} randomizes domain (not fixed). {{random.email}}@example.com appends fixed domain to full email (invalid).
Final Answer:
{{random.username}}@example.com -> Option A
Quick Check:
Random username + fixed domain = {{random.username}}@example.com [OK]
Hint: Combine {{random.username}} with fixed domain for custom emails [OK]
Common Mistakes:
Using {{random.email}} which randomizes domain too
Randomizing domain when fixed domain is needed
Appending domain to full email causing invalid format