Is there a feature in Postman that runs a test only once before all others

1.6k Views Asked by At

In mocha there are the before and after functions that you can use to set up and tear down testing suites. Is there a similar feature in Postman? I want to get an apikey without having to run the request every single time I iterate through a collection.

2

There are 2 best solutions below

3
On

Actually, that's a paid feature of the new Postman Chrome app. You are probably still using the old legacy version.

0
On

I think you can create a folder in your collection and move it to the top of the collection and that will have it run and collect all the data like cookie or bearer token that you need for the other tests. You can also set up a folder at the end called breakdown that will clean up all your work.

enter image description here