Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
My question:
Hi I tried to pass some environment variable via command line to my node.js + newman script. But didn’t get it working, could someone please help me here?
Details (like screenshots):
My run.js as below
const newman = require('newman');
const appName = process.env.NAME;
const fileName= `../collection/${appName}-collection.json`
var options ={
collection: require(`${fileName}`),
envrionment: envrionmnet.get(),
reporters:'cli',
envVar: [
{
"key":"env",
"value":`${process.env.ENV}`
},
{
"key":"country",
"value":`${process.env.COUNTRY}`
},
]
}
newman.run(options, function(err,summary){
}
where I try to pass the variable in the command line:
NAME=abc ENV=qa COUNTRY=us node scr/run.js
but the environment.json seems not to take these two variables