Incoporating Newman / Postman with Jenkins

Updated on 28 Dec 2018

Incorporating Newman / Postman with Jenkins is a fairly straight-forward process. In fact, it is not much different from using Codeception.

Running Newman for Jenkins

Just like running codeception where we need xml output file for Jenkins, we can run Newman in a similar fashion. The basic way of running Newman for Jenkins is like this;

newman run $WORKSPACE/postman/test1.postman_collection.json -r junit --reporter-junit-export $WORKSPACE/postman/mama_test.xml


  • -r report
  • –report-junit-export /directory/file where the export will be written

Here we are using junit

If --report-junit-export is not specified, then Newman will write the output to a folder called newman with the filename named after the collection runner appended with a timestamp.

Inside Jenkins

In this new version of the project, I have moved the existing to Now contains the code to run the Postman tests.

# this is testing newman.  newman is a test-collection runner for Postman.

newman run $WORKSPACE/postman/test1.postman_collection.json -r junit --reporter-junit-export $WORKSPACE/postman/mama_test.xml

Next we need to add this script as part of the build, and Process xUnit test result report. This time make sure that we specify JUnit test result - the output we specified when we ran Postman on the command line (Newman).

Notice in this setup, the JUnit Pattern also matches the value for --reporter-junit-export.

Conditional Step

We have still placed the conditional step at the end. This is because if a build status fails, it can not be overwritten by a latter build step that succeeds. I.e. Our first lot of tests that we run are with codeception, the second are with Postman. Successful tests with postman wont overwrite a fail state from codeception, so it is safe to put our conditional step after all our tests have run.