Hello,
My collection is generally built around doing contract testing. However, there are certain workflows I would like to test. I would like to reuse the existing requests so I can avoid having duplicate requests in my collection. My idea was to use setNextRequest to accomplish this. However, it is not working as expected.
As a proof of concept I setup a collection runner to run in a single folder. I created two placeholder requests: “Start Sequence” and “End Sequence”. I setup the collection runner to run those two requests (see snip). In the post request script for “Start Sequence” I have pm.execution.setNextRequest("player 539BD86C");
. When I run the collection runner, only “Start Sequence” is executed.
console.log('Start Sequence Post request start');
pm.test("Status code is 404", function () {
pm.response.to.have.status(404);
});
pm.execution.setNextRequest("player 539BD86C");
console.log('Start Sequence Post request end');
From playing around with this some more, it seems like I still need to select the request that is being set by setNextRequest when I setup the collection runner. If this were a more complicated workflow, this would mean manually selecting several requests spread out in my collection.
In an ideal scenario, I could create a request like “User Management” and running that via a collection runner would auto-magically make the 8 different requests needed without me needing to manually select those requests. Is using setNextRequest the way to do this or is there another option?
Thanks.