Hi all,
In the following Topic Improve postman.setNextRequest() suggestions were made to improve the postman.setNextRequest() function. I am yet to find any documentation on improvements that have been made ( I might have not used the right search terms). Anyhow I have stumbled upon a problem of my own using the postman.setNextRequest() function.
Problem encountered
In my collection I have made several folders with one or multiple requests. When I want to run the postman runner not all the folders have to be run. To save time and having to take folders out or comment everything I have tried using the function to build a workflow. I have placed the function in the pre-request Script of the folder in order to have the folder after the one containing the function to be skipped, like following:
folder A request A1, A2
folder B {pre-req: postman.setNextRequest(âreq d1â}, request B1, B2
folder C, request C1, C2
folder D, request D1, D2
I expect the requests in folder B to be executed then to have folder C and his requests to be skipped and the workflow to continue with the first request in folder D.
However in my case
postman executes request B1
skips B2 unexpected
skips folder C and his request and continues in folder D with request D1 as expected
Screenshots and workflow
See following screenshots for the acts I preformed.
This is the first folder where I have applied the setNextRequest function with a simple log so I can read in the console which folders are not executed.
This is the second folder where I have applied the same as explained at the first screenshot.
This is the workflow I get due to the use of the setNextRequest function. In the pre-req of the folder âWebshop retrievalâ I have the setNextRequest(âalle artikelgroepenâ); The âSwagger webshop ophalenâ gets executed and the two folders aanbod and artikel are skipped and the workflow enters the folder Artikelgroep.
In this folder (Artikelgroep) I have the setNextRequest(âAlle fustenâ). The first request in the folder gets executed as set, but the second one (Specifieke artikelgroep) gets skipped and the workflow continues as draw.
I need the second request within the folder to get executed as well. Does anyone has a solution on how to achieve that?
I hope it is clear enough to follow!