To run the postman collections in Jenkins , follow the below steps.
- Download the Node js (64-bit) using below link and install the Node js application
- To check whether it is installed correctly, open the node js application and press “ctrl + c” twice and verify application is getting closed.
3.Add the Node executable to your system path. Go to the Control Panel > System and Security > System > Advanced System Settings > Environment variables. Append this to the end of the PATH variable: ; C:\Program Files\nodejs.
If it is installed in a different location, need to set the PATH accordingly.
- After successfully installed Node js, need to install Newman using command prompt. Open cmd and check the node version before installing newman.
5.Use below command in command prompt to install Newman.
“npm install -g newman”
- Navigate to Postman application and export and save the collections in json format.
- Open jenkins and create new item and freestyle project
- Navigate to project and configure the newman run to run the postman collections in jenkins.
- Navigate to build tab and add build step as “Execute shell ” and use below command to run the postman collection.
“newman run <YourCollectionFile.json>”
- Navigate to Manage jenkins > Configure system to set Environment variables path for Node js and Shell executable path to run shell command.
- After all the above configurations are set, navigate back to project and schedule the build to run the postman collections.
12.Now the scheduled build ran successfully and navigate inside the project to view the console output.