Hi,
I’m new to postman and am trying to create a collection with 5 requests.
The requirement is that the Request 1 runs for every iteration. After that I need to run only 1 of the other 4 requests based on the first column in the datasheet (CSV File) I’m using for running the collection. Once that request is executed, I need to begin the next iteration by running the Request 1 again. For this, I’ve given the below If block in the Test of Request 1.
var RequestToExecute = pm.iterationData.get(“Request”)
if (RequestToExecute === “Req2”) {
postman.setNextRequest(“Request 2”);
}
else if (RequestToExecute === “Req3”){
postman.setNextRequest(“Request 3”);
}
else if (RequestToExecute === “Req4”){
postman.setNextRequest(“Request 4”);
}
else if (RequestToExecute === “Req5”){
postman.setNextRequest(“Request 5”);
}
else if (RequestToExecute === “END”){
postman.setNextRequest(“null”);
}
In the Test of Requests 2 to 5, I’ve used the setNextRequest statement to reference Request 1.
The issue I am running to is that the Iteration not getting incremented and same row is running again and again in an infinite loop. Can someone please help me in how to increate the Iteration count in the Test section.