0

For some reason Newman doesn’t call a number of requests that are available in the Postman pre-request, but only the beginning and the last request. I start Run in postman - all requests in the pre-request are called, but Newman does not see them.

It all started about a month ago, before that, all pre-request requests to Newman were called - OK

npm -version
 7.20
newman -version
 5.2.4
nodejs -version
 16.5.0

My sendRequest block in Postman pre-request

    // Request #3
    pm.sendRequest({
        url: pm.environment.get("url") + "/reset/password",
        method: "POST",
        header: {
            "content-type": "application/json",
            "Authorization": "Bearer " + pm.environment.get("access_token")
        },
        body: {
            mode: "raw",
            raw: JSON.stringify({
                "new_password": pm.environment.get("r.srting")
            })
        },
    }, function (json, response) {
        console.log("access_token_2 is ", response.json().access_token);
        pm.environment.set("access_token", response.json().access_token);

enter image description here enter image description here

juran
  • 59
  • 1
  • 4

1 Answers1

0

I found the reason for this behavior of Newman - the fact that the input data changed in the Postman environment in the Current field, and not in the Initial field, and when the file with the environment was exported to the Git repository, the data in environment.json was old.

And the data that is retrieved from the server response is completely different, which is expected, a TypeError error goes and the requests do not go further. Maybe it will help someone that initially the input data in the environment needs to be updated in the Initial field

juran
  • 59
  • 1
  • 4