I have a test collection in postman. I have a pre-request script to be run at the Collection level, but there are specific requests in the collection where I'd like the pre-request script not to run.
How can I achieve this?
I have a test collection in postman. I have a pre-request script to be run at the Collection level, but there are specific requests in the collection where I'd like the pre-request script not to run.
How can I achieve this?
You cannot do it, but as a workaround just add a condition for collection script like:
if (pm.info.requestName !== "the request you want to skip") {
}
If you want to do it dynamically, then you have to do it from the request running before the request you want to skip:
For example:
In request 1:
pm.variable.set("skip", true) // to skip request 2
in request 2:
pm.variable.set("skip", false ) // to ensure remaining requests don't skip collection script
And in collection add
if (!pm.variable.get("skip")) {
//then execute
}