Search code examples
postmannewman

Struggling to run a collection with specified environment via Newman


Pre condition: I have Newman installed. My collection and environment .json files work fine in postman

Problem When I run this command "newman run collection.json –e env.json" via powershell on my local machine or via CI using the "postman/newman_alpine33" docker.

I get this error:

  POST {{baseUrl}}/api/student/create [errored]
     getaddrinfo ENOTFOUND {{baseurl}}

The {{baseURL}} is referring to environment variable in the env.json that should be used in the collection.json.

Take note: I have tried this with other terminals as well and problems still exist.


Solution

  • Solution: There was an extra space between run and collection.json, when I removed the space then it worked. Must be like this: "newman run collection.json –e env.json" and NOT like this"newman run collection.json –e env.json"