What is a pre-request script for?
QuizEasy-MediumAsked in: Capgemini, Infosys
Every run of a sign-up request needs a new, unique email. Where do you generate it?
- In a pre-request script, for example pm.variables.set("email", "user" + Date.now() + "@example.com"), then use {{email}} in the body
- In the post-response (Tests) script
- In the environment file, typed by hand before each run
- Postman cannot create values at run time
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.