const helper = eval(pm.globals.get("helper"));
pm.test("Make retry ", helper.retry(200, 2, "RemoveDriverOffer", 2000));
You seem to have this postman.setNextRequest();
line which won’t do anything.
That function takes an argument, either null
to stop the execution of the name/id
of the next request.
@michal.robaszewski.j updated function uses the Next_request
value passed into the retry function - It doesn’t look like you’re using that anywhere.
As according to the Postman documentation workflows should work as is follows:
If postman.setNextRequest() is absent in a request, the collection runner defaults to linear execution and moves to the next request
Isn’t it?
So even with the postman.setNextRequest() is empty the next request executed
and indeed it is.
This doesn’t affect on the flow execution the flow executed as expected
but Newman return exit code 1
What’s the point in having that line in there then
Newman itself has a number of different flags that could be used - I’m not sure what’s causing it to return that exit code but you could look into:
-x, --suppress-exit-code
Specify whether or not to override the default exit code for the current run.
--timeout <ms>
Specify the time (in milliseconds) to wait for the entire collection run to complete execution.
--timeout-request <ms>
Specify the time (in milliseconds) to wait for requests to return a response.
As you said above it’s copy&paste but even though that’ line not the point
I’ve tried Newman CLI as well and it’s not help me.
This one: -x, --suppress-exit-code for example just override exit code forwhole pipeline flow
In my case i need yo use exit code override only if one of the retries has been succeeded
Hi, The variable Next_Request when using setNextRequest is crucial.
When you Break the Linear execution you are in command.
If you declare setNextRequest in script with null or empty value it will just stop execution when it hit that line using Newman. I don’t know if this is expected feature but providing variable with next request name is god enough solution in most cases.
You have to provide next request to chain it again if you want it to continue.
In next request it will just flow again with Linear logic top to bottom.
Its hard to maintain the naming of following request to be executed but with some name convention you can deal with it.
Cheers!
As according to the Postman documentation workflows should work as is follows:
If postman.setNextRequest() is absent in a request, the collection runner defaults to linear execution and moves to the next request
So even with the postman.setNextRequest() is empty the next request executed
and indeed it is.
Does it give you a different result if you add postman.setNextRequest(Next_Request);
to the 2 places that @michal.robaszewski.j has it in the script you copied. He authored that script so would have more context around the execution paths and why things are in there.
This is also the incorrect way to use that function postman.setNextRequest();
so if you’re using it, you might as well use it as it’s been implemented, add null
or a request name/id
, or just completely remove it from the script.
Moving past this, what did you want to see happen on the final report? Newman is telling the reporter what happened during the execution, if it sees that a request was run it will show it. The same thing will happen on the CLI output and any other reporter that gets it’s data from Newman.
The script work as expected for both ways:
postman.setNextRequest(Next_Request)
postman.setNextRequest()
and linear flow executed as well for both but Newman return exit code 1 once
one of the retries attempts has been failed
Is there a reason or an error message to suggest why it fails.
Did the script fail or the request fail?
The exit code in itself doesn’t really give anyone any clues as to why it failed.
of course all the point of the retry mechanism is to overcome such issues as timeouts and hang up
so in my case this timeouts