How do I make Jenkins build fail when Newman tests fail

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 am stuck with this issue -
eg- I have 2 collections one passes and one fails , both are fired by two separate newman commands.

newman run col1.json this contains failure test case
newman run col2.json this passes

when integrated with jenkins as last executed is col2 and it successfull the build result is success, but it should be failure, do have any idea

This also has been raised at How do I make Jenkins build fail when Newman tests fail · Issue #853 · postmanlabs/newman · GitHub. I donot know how can I resolve this issue. Could someone please advise.

It looks like you have a solution for this already based on the GitHub issue you raised.

However I will mention a solution that I have used and seems to work for me.
I simply use a bash script and put my Newman runs in there.

I add set -e at the first of my script. This will tell it to exit on error if there is an issue, this in my case results in a failure on the Jenkins job.

Hopefully this helps you and others that have an issue.