Run Postman collections on Jenkins CI/CD Pipeline

Step-by-step guide on how to configure Jenkins and run Postman Collections using CLI commands

Run Postman collections on Jenkins CI/CD Pipeline

Postman CLI makes it easier to integrate with CI/CD tools like Jenkins and run collections using the Pipeline script

Steps to integrate Postman CLI with Jenkins Pipeline:

1. Select any collection and click on Run Collection.

2. Select Automate runs via CLI under "Choose how to run your collection"

3. Click on Configure command under "Run on CI/CD"

4. Select your Collection and Environment if being used for the collection

5. Select CI/CD provider as Jenkins and Operating System for CI/CD as Windows

6. Copy the command generated by Postman under Postman CLI command preview

7. Click on Generate API Key and provide a name for your API Key (Ex - Jenkins_CI)

8. Click on Generate and copy the API key and store it in a safe place.

9. Open Jenkins go to Dashboard

10. Click on New Item and enter an item name (Ex  - Postman Collection)

11. Select Pipeline as the project type and click on Ok

12. Click on Pipeline under Configure

13. Copy the commands generate by Postman in Step 6 and paste in the Script section

14. Remove the first 3 lines which are commented.

15. Replace 'sh' with 'bat' command everywhere in the script

16. Replace the $POSTMAN_API_KEY variable with your API key generated in Step 8

17. Click on Save

18. Go back to Dashboard -> Click on Manage Jenkins -> Click on Manage Plugins

19. Click on Available Plugins

20. Search for Node plugin

21. Select the plugin and click on Install without restart

22. Go back to Dashboard -> Click on Manage Jenkins -> Click on Global Tool Configuration

23. Scroll down to NodeJS section

24. If NodeJS is not already installed. Download and install it from here - https://nodejs.org/en/

25. Open command prompt and type 'node'. Node.js version should be displayed

26. In Global Tool Configuration, enter a Name and Installation directory for nodejs

27. Click on Save

28. Go back to Dashboard -> Click on the project (Postman Collection) -> Click on Configure -> Click on Pipeline

29. Replace "{your_nodejs_configured_tool_name}" variable in line 5 with the name of your nodejs installation name provided in Step 26 - 'node'

30. Click on Save

31. Now click on Build Now for the project

32. Build will be successful after some time

33. Click on the Build Number and click on Console Output

34. Scroll down to the bottom of the output and click on the Postman results link

35. Page will be redirected to Postman where you can view the run results for the collection

Bijan Patel
Full Stack Test Automation Expert | Selenium Framework Developer | Certified Tosca Automation Specialist | Postman | DevOps | AWS | IC Agile Certified | Trainer | Youtuber | Blogger|

Launch your GraphyLaunch your Graphy
100K+ creators trust Graphy to teach online
𝕏
QASCRIPT 2024 Privacy policy Terms of use Contact us Refund policy