Possible to run the same tests for multiple collections within the same Workspace?

I’m testing multiple collections in Postman. Each collection includes at least 30+ endpoints. Is it possible to execute the same tests for multiple collections at the same time within the same Workspace?

I’ve tried adding multiple collections to a Runner, but the runner only holds 1 collection at a time. Combining collections into one isn’t ideal because we’d like to keep the services/APIs collections separate.

After doing some ‘Googling’, it seems like we’re only able to create tests at the Collection level then just copy/paste the tests to each different Collection. But I wanted to check with this group in case anyone had some hacks for doing this :smiley:

Thanks!

2 Likes

Write all your tests and store them in a variable using the first collection pre-request script.

In all of the other collections, you just get your variable and run those tests.

Pre-request script:

var assertionTests = () => {

   pm.test("Status code is 200", function () {
   pm.response.to.have.status(200);
   });
}

pm.globals.set("validationTests", assertionTests.toString());

Test Script:

eval(pm.globals.get("validationTests"))();
1 Like

You can try a mini hack depending on the amount of times you want to run the collections.
You can schedule Jobs in the Monitoring section, one job per collection to start at the same time.
There is however a limit per month but it may help.

1 Like

Thanks for the tip, Kristof!

1 Like

Hi Ioan,

I’m not familiar with the monitoring section, but I’ll also look into this. Thank you!

1 Like