Postman: pre-request script vs Tests tab — what runs when?
I keep putting logic in the wrong tab and chaining requests behaves weirdly.
postmanscripting
I keep putting logic in the wrong tab and chaining requests behaves weirdly.
Accepted solution
Pre-request script runs BEFORE the HTTP call — use it to set headers, mint auth tokens, generate dynamic bodies. Tests script runs AFTER the response arrives — use it for assertions and to save values (pm.collectionVariables.set) for the next request in the collection runner.