Different behaviour in Collection Runner vs. Newman

Hi all,

my general workflow (simplified) within a collection is:

  1. Create something
  2. 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);
 } else {
   // 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,

PS.: How can I format that code example properly?! :-o

I am not sure your problem comes directly from your code.
Did you try using the htmlextra report and look into what was sent / received?

Maybe there is a variable in the URL / body that is not properly resolved.


Outch! :see_no_evil:
There´s indeed a problem in out test environment, thanks for pointing that out!

1 Like
the code goes here


const xyz = [1,2,3,4];
JSON.parse(`{"abc" : "is a string"}`);