Dynamic Placeholders
Dynamic placeholders generate unique test data for each run, making tests more realistic and avoiding conflicts.
Overview
Instead of hardcoding values like test@example.com, use placeholders which generate unique values for each test run.
Placeholder Types
Run Placeholders
Generate new values for each test run:
| Placeholder | Description | Example Output |
|---|---|---|
{{run.email}} | Unique email address | john.smith.x7k9@test.bug0.com |
{{run.fullName}} | Random full name | John Smith |
{{run.shortid}} | Short unique ID | x7k9m2 |
{{run.dynamicEmail}} | Email with working inbox | user.abc123@inbox.bug0.dev |
Global Placeholders
Generate values once per execution and reuse across all test cases:
| Placeholder | Description | Use Case |
|---|---|---|
{{global.email}} | Shared email across tests | Register in test 1, login in test 2 |
{{global.fullName}} | Shared name across tests | Create profile, verify display |
{{global.shortid}} | Shared ID across tests | Create resource, reference later |
{{global.dynamicEmail}} | Shared inbox email | Register, verify email, login |
Email Extraction
Extract content from received emails:
| Placeholder | Description | Example |
|---|---|---|
{{email.otp:Extract the 6-digit verification code}} | Extract OTP | 847293 |
{{email.link:Extract the password reset link}} | Extract URL | https://app.com/reset/abc123 |
{{email.text:Extract the welcome message}} | Extract text | Welcome to our platform! |
Using Placeholders
In Step Data
Add the placeholder to the Data field of a step:
Step: Enter email in the registration form
Data: {{run.email}}
In Multiple Steps
Use {{global.email}} when the same value needs to be reused:
Step 1: Enter email in registration form
Data: {{global.email}}
Step 2: Enter email in login form
Data: {{global.email}}
The same email is used in both steps.
For Email Verification
Step 1: Enter email
Data: {{run.dynamicEmail}}
Step 4: Enter verification code
Data: {{email.otp:Extract the verification code}}
The dynamicEmail placeholder creates a real inbox that can receive emails. Use with email extraction placeholders to get content like OTPs.
Run vs Global
When to Use Run Placeholders
Use run.xxx when another step within the same test needs to access the variable:
- Values only needed within one test case
- Each test should use different data
- No data sharing needed between tests
When to Use Global Placeholders
Use global.xxx when variables need to be consistent across all tests in an execution:
- User created in one test, used in another
- Data must persist across test cases
- Shared state between tests
Example: User Registration + Login
Test 1 (Registration) and Test 2 (Login) both use {{global.email}} to ensure the same user email is used.
When to Use Dynamic Email
Use dynamicEmail (either run.dynamicEmail or global.dynamicEmail) when you need the automatic email extraction feature:
- Your test flow requires receiving and reading emails (e.g., OTPs, verification links, magic links)
- You need to extract content from emails using
{{email.xxx:prompt:emailAddress}} - Regular
emailplaceholders generate a formatted email string but cannot receive emails
Email Verification Flow
Complete Example
1. Navigate to registration page
2. Enter email address
Data: {{run.dynamicEmail}}
3. Enter password
Data: TestPassword123!
4. Click "Register" button
Wait Until: Verification email sent
5. Enter verification code
Data: {{email.otp:Extract the verification code}}
6. Click "Verify" button
Wait Until: Registration complete
How Email Extraction Works
- Test creates account with
{{run.dynamicEmail}} - Your app sends verification email
- Bug0 monitors the inbox (up to 60 seconds)
- AI extracts requested content from email
- Value is substituted in the step
Best Practices
Use Global for Shared Data
Use {{global.email}} when the same user logs in across tests.
Be Specific in Email Extraction
Describe exactly what to extract: {{email.otp:Extract the 6-digit verification code}} is better than {{email.otp:Get the code}}.
Use Dynamic Email for Real Inboxes
Use {{run.dynamicEmail}} for email testing - it creates a real inbox. The regular {{run.email}} just generates a formatted email string without an inbox.
Troubleshooting
Placeholder Not Replaced
- Check syntax: ensure double curly braces around the placeholder
- Verify placeholder type exists
- Check for typos
Email Extraction Timeout
- Email may not have arrived yet (60s limit)
- Check your app is sending to the correct address
- Verify email service is working
Global Value Not Shared
- Ensure same execution ID across tests
- Check you're using
global.notrun. - Verify tests run in sequence, not parallel
Available Placeholders Summary
| Category | Placeholder | Scope |
|---|---|---|
{{run.email}} | Per test | |
{{run.dynamicEmail}} | Per test (real inbox) | |
{{global.email}} | Per execution | |
{{global.dynamicEmail}} | Per execution (real inbox) | |
| Name | {{run.fullName}} | Per test |
| Name | {{global.fullName}} | Per execution |
| ID | {{run.shortid}} | Per test |
| ID | {{global.shortid}} | Per execution |
| Extract | {{email.TYPE:PROMPT}} | From received email |