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.
I have a tests script in Postman where I access the data using pm.environment.get(“lastSetDate”) How do I achieve the same using
Not really sure what you’re trying to do there, that Newman run doesn’t include an environment so it wouldn’t currently run with one.
You can’t use any of the same pm.* commands outside of the collection like that because that node script doesn’t know what they mean.
The Newman Summary object will contain information about the full run though and you can access that in a similar way as you have done in the ‘request’ event.
Unfortunately, the data is not in JSON but in HTML but that is not what I want, it’s the value of pm.environment.get() to be written on a file. Tried using beforeDone, done and JSON.stringify (data. environment) but all are giving undefined
Yes, it was a typo on my side. It’s working. Just a quick question How do I access a variable from data.summary.environment let say the variable name is lastSetDate. This is the output {"type":"any","value":"2010-08-06T18:30:00.000Z","key":"lastSetDate"}
Hi @kappagaa ,
thanks, this is working. Am able to read environment variable value now.
Is there any way to read specific collection variable from summary.collection?
If yes, can you please share the syntax?