I have this postman logic:
var returnData = JSON.parse(responseBody);
tests["status code"] = (responseCode.code === 401);
if (responseCode.code === 401) {
postman.setNextRequest("get token with good login");
}
Even though status code is 401, that "setNextRequest" never get executed.
I am new to postman so maybe I am making a mistake somewhere?
Appreciate any pointer as to how I can chain this test and have it go onto to the next one?
thanks
-vincent
Step1 − Click on the Runner menu in Postman. Step2 − The Collection Runner window shall open up. Step3 − Choose the name of the Collection from Choose a collection or folder. Step4 − Select an Environment from the Environment field.
In Postman, we can also work on branching and looping. We can branch and loop across API requests with the help of setNextRequest() function. This function is used to set the request to be executed next. This function takes one argument, i.e., the name of the request, which will execute next.
POSTMAN workflow is the order of request execution within a collection. When you run the collection directly, then the requests are either executed randomly or executed serially.
I figured out what's wrong. I need to run the sequences in "Runner". I was merely pressing "Send" beforehand.
Thanks for your reply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With