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.
Hi All!
I have the following pre-request script:
let today = pm.collectionVariables.get("currentDate");
let newdate = new Date(today);
pm.variables.set("startDay", new Date(newdate.setDate(28)).toLocaleDateString('en-US'));
It returns date in the format: 10/28/2023
Further this date use in the request:
{
"---": {
"---": 2,
"Name": "---",
"---": true
},
"---": {
"---": false,
"CreatedDate": "{{startDay}}",
"---": 1,
"---": {
"---": 1,
"---": 2
},
"Points": [
"{{startDay}} 12:00"
]
}
}
It works fine when I run test manually or run collection in the Postman.
But, when I ran the same in Newman, I got the following:
│ }
│ {
│ ---: { ---: 2, ---: '---', ---
│ : true },
│ ---: {
│ ---: false,
│ CreatedDate: 'Invalid Date',
│ ---: 1,
│ ---: { ---: 1, ---: 2 },
│ Points: [ 'Invalid Date 12:00' ]
│ }
│ }
Of course all tests fail.
What could be wrong?
Maybe it needs to be formatted somehow for the Newman?