Configure Postman Scripts in Jenkins

     We discussed the Jenkins pipeline in one of the previous articles. Here, I have Postman collections to run using Jenkins. We know that the Postman collections are the set of API requests for different purposes created using the Postman tool. In this article, we are going to discuss the Jenkins configuration for Postman collection execution, execute Postman collection from the local system where Jenkins is configured, and execute Postman collections using the JSON link that is configured in Jenkins. The following are major steps involved in the configuration and execution:

  • Jenkins installation.
  • Manage NodeJS plugin and newman package in Jenkins.
  • Create API collection using the Postman tool.
  • Setup Jenkins project.
  • Configure Build Environment and Build.
  • Troubleshoot by Build Now and validate the console.
  • Configure the schedule build trigger.
Jenkins installation

     Download Jenkins from the official site of Jenkins You can download the latest version that is compatible with your Operating System. Once Jenkins is downloaded to your system, you can install it. Once the Jenkins server installation is complete, ensure the server is running automatically. You can check the server execution via System Services as below,

     If the server is not running or not able to start using your user profile, please run the Services app as Admin and start the Jenkins services.

     Next, go to your Jenkins server (it’s at http://localhost:8080 by default if you are running it locally) and sign in to it when once the Jenkins service is up and running. Once you sign in to the Jenkins server, you can install all the necessary plugins and finish it.

Manage NodeJS Plugin and newman Package in Jenkins

     To install the NodeJS plugin you have to select the Manage Jenkins option from the Dashboard of the Jenkins server. Select the Manage Plugins option, go to the Available section and search NodeJS plugin and install it. Once it gets installed and checks whether the plugin is installed by accessing the Installed section and searching NodeJS. Next, we need to configure the newman package via Global Tool Configuration. Access the Global Tool Configuration option from Manage Jenkins. Scroll down and go to NodeJS section, click on Add NodeJS button, enter a name like nodejs, then enter the package name newman at Global npm packages to install section and click on Apply then Save. Now, you are installed NodeJS and configured the newman package successfully.

Create API collection using the Postman tool

     This is an independent step and the API collection creation using the Postman tool. In the collection I have created two API requests; one to get the list of users and another one to create a user. Following are the details:

     Once the API requests are created, we can export the collection as a JSON file and store it in your local system. We will use this path later in the Build section of the Jenkins project Configure.

Setup Jenkins project

     To setup a new Jenkins project, go to the Jenkins Dashboard and click on the New Item option, enter the item name as your project name (I have given JenkinsPostmanDemo) then select Freestyle Project type and click OK. This will create a new project in Jenkins Dashboard.

Configure Build Environment and Build

     Once complete the Jenkins project creation, we need to configure the build environment and build via the project’s configure section. Go to your Jenkins project and access Configure option. Then go to the Build Environment tab, select Provide Node & npm bin/ folder to PATH option and we will see the nodejs automatically selected (that was added via Global Tool Configuration). Next click Apply button. Now we completed the Build Environment Configuration.

     Next access the Build tab and click on Add build step dropdown. Select Execute Windows batch command option (I am using Windows Operating System) and enter the below command in the command text area:

newman run "D:\JenkinsDemo\JenkinsDemo.postman_collection.json" --disable-unicode 

     We can map the local postman JSON collection path or we can mention the JSON share link from Postman Collection.

Below is the command for execution with the JSON share link:

newman run "" --disable-unicode

     When using the – -disable-unicode option, the output should only consist of non-unicode characters. Next step, we can click Apply and Save buttons.

Troubleshoot by Build Now and validate the console

     In this step, we can run the build and validate the output via the console. We can manually trigger the build by clicking the Build Now option and we will see the build execution status in the Build History section.

     Open the triggered build and select Console Output, we can see the execution status and also the test results as below,

Configure the schedule build trigger

     Above we discussed the manual build trigger and validate the results. Next, we will discuss the schedule build trigger in Jenkins. To do this, we have to select Configure option of the Jenkins project and go to the Build Triggers tab. Then select the Build periodically option and enter the cron time to begin the schedule. For example, enter H/30 * * * * to trigger the build every 30 minutes. Next, click Apply and Save buttons to reflect the changes.

     I hope you really enjoyed reading this article and you got some idea about the Jenkins installation, configuration, and execution of Postman collections. You can try this in your project wherever you have a requirement to configure the Postman collections and build triggers via Jenkins.

make it perfect!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: