I need to generate a dynamic email address, username for API automation testing in postman. can you help me with this please.
Asked
Active
Viewed 2,746 times
1 Answers
0
I see two options on how you can get what you need.
Using already defined dynamic variables, such as timestamp: For example where you need a new email address, just use this:
user_{{$timestamp}}@example.com
The request will be sent with something like: user_1497475549@example.com
Define an variable in the pre-request script:
var randomEmail = 'DO YOUR PREFERRED RANDOMIZATION HERE'; pm.setEnvironmentVariable("email", randomEmail);
and use that variable like {{email}} when sending the request.

Valentin Despa
- 40,712
- 18
- 80
- 106
-
If I want to retrieve the email address used by the variable than how can I achieve this as response body doesn't give email address. – Uppi B Jun 15 '17 at 11:29
-
I am not sure I understood your last question. – Valentin Despa Jun 16 '17 at 05:56