Running Postman collections in CLI newman error - getaddrinfo ENOTFOUND {{base_url}}

2.6k Views Asked by At

I have written test cases for API collections in postman and trying to run those through Newman plug-in in my local machine. I have downloaded the JSON file in documents on my mac

I am using this command to run : newman run QA_api_testing.postman_collection.json

getting below error with all the api’s failing error message: GET {{base_url}}/companies/active/all [errored] ** getaddrinfo ENOTFOUND {{base_url}}**

enter image description here pls help me

1

There are 1 best solutions below

0
On

You have defined a variable base_url, and newman doesn't know it.

Define base_url as an environment variable, export it, and pass the file as a parameter to newman.

Alternatively, you could simply add that one value to your newman call, by adding: --env-var base_url=https://YourUrl