Back to All Questions
Question 37 of 100
Intermediate API Testing
Intermediate
Q37: What are Dynamic Variables in Postman? Generating Fake Data.
🔄Core Concept
What are Dynamic Variables in Postman? Generating Fake Data.
Key Takeaways & Architecture Summary
- ✓Built-in random generators provided natively inside Postman.
- ✓Generate fake emails, GUIDs, timestamps, and usernames on the fly.
- ✓Preceded by a dollar sign: {{$guid}}, {{$randomEmail}}, {{$randomFirstName}}.
Direct Answer Summary
Dynamic Variables are built-in generators in Postman that populate random data on the fly. Syntactically represented using double curly braces and a dollar prefix (e.g. `{{$randomEmail}}`, `{{$guid}}`), they are ideal for generating unique payloads, preventing database constraint failures during automated test runs.
⚠️ Senior Engineering Warning (Red Flag)
Do not use dynamic variables inside assertions that require absolute, predictable output states. Dynamic variable outputs change on every request run, which can cause assertions to fail.
💡 STAR Architectural Explanation & Pro Tip
Dynamic variables are powered by the Faker.js engine under the hood, allowing you to generate hundreds of mock identities, addresses, and phone numbers automatically.
RestAssuredTest.java
Rest-Assured + Java// JSON payload utilizing dynamic mock variables
{
"transactionId": "{{$guid}}",
"email": "{{$randomEmail}}",
"timestamp": "{{$timestamp}}"
}