Hi all,
my general workflow (simplified) within a collection is:
- Create something
- Query certain things
Problem is, that creation sometimes fails, due to timeouts, environment not being available, you-name-it, so I want to give it a retry, especially when running the collections in Jenkins via newman.
So I came up with some Javascript in the testtab of my very first request:
if (!pm.environment.get("collection_tries")) {
pm.environment.set("collection_tries", 1);
}
if ((pm.response.code != 201) && (pm.environment.get("collection_tries") < 3)) {
var tries = parseInt(pm.environment.get("collection_tries"), 10);
pm.environment.set("collection_tries", tries + 1);
setTimeout(function() {}, 5000);
postman.setNextRequest(request.name);
} else {
pm.environment.unset("collection_tries");
// my tests
}
This is working perfectly fine in the Collectionrunner.
But when I execute it via Newman, I always get ā500 URL Open errorā.
Any ideas what is causing this?
Many thanks in advance,
Christian
PS.: How can I format that code example properly?! :-o