Running postman collections using Newman in Jenkins

Reading Time: 3 minutes

We can write the automation test suite for any service which can be used for performing regression testing. But we can also integrate our automation test scripts using Newman in Jenkins CI/CD pipeline which can be triggered automatically whenever a pull request gets merged.

We need software installed on our system locally:

  • Jenkins
  • Node
  • NPM
  • Postman (For writing the collection)

Files for execution

  • Firstly create a postman collection that is to be run using Newman and store it in a folder.
  • Now check-in your collection into your git repository. We need the link to the git repository which we will use in the further steps.

Setting up Jenkins pipeline

  • Now start your local jenkins with command:
systemctl start jenkins
  • After logging in go to new item.
  • Give a name to you project, select freestyle project and click OK.
  • Scroll down to Source Code Management section of the page and select git.
  • Enter the link to your git repository
  • If you are using an private repository you can add you credentials.

Go to buld section, click on add build step and select execute shell.

  • Write the Newman command to execute your postman collection.
newman run Mycollection.postman_collection.json
  • Click on save, go to your newly created project and click on ‘build now’
  • Click on the running build and click on console output.
  • Here we can see the result of our current test run. That how many tests failed or passed and also shows if the build is successful or not.

So this was a small introduction on how to execute postman collection with Newman in Jenkins. It is very helpful for CI/CD while development of services.

Written by 

Ankur is a QA Consultant having experience of more than 1.5 years. He is familiar with the core concepts of manual and automation, postman and Newman are his expertise. He is always eager to learn new and advance concepts in order to expand his horizon and apply them in project development with his existing knowledge. His hobbies include watching web series and getting to know about all the latest gadgets that come in the market.

1 thought on “Running postman collections using Newman in Jenkins3 min read

Comments are closed.