Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Postman tests in jenkins


Published on

Guide to integrate Postman collections into Jenkins CI (using newman command line tool)

Published in: Internet
  • Hey guys! Who wants to chat with me? More photos with me here 👉
    Are you sure you want to  Yes  No
    Your message goes here

Postman tests in jenkins

  1. 1. Postman tests in Jenkins Integration of postman collection for REST API testing into Continuous Integration flow
  2. 2. Postman collection. Definitions ● Request (defined REST API request with a set of validation tests) ● Folder (set of Requests) ● Collection (set of Folders and Requests) Collection should be considered as “root” folder for your project. Folders can be used to organize requests by component, by feature, by date or any other groups.
  3. 3. Postman. Collection example
  4. 4. How to integrate created tests in CI? ● Export environment variables ● Export collection ● Push exported files to Git (or other VCS) ● Install NodeJS and NPM on your CI server ● Install newman on CI server ● Add CI job (or task/action/rule depending on CI terminology) to run newman after deploying your REST API
  5. 5. Export Postman tests
  6. 6. Postman. Export environment variables
  7. 7. Postman. Export collection
  8. 8. Push files to Git (e.g. Github, Bitbucket or local Git server)
  9. 9. Setup prerequisites
  10. 10. Install prerequisites ● NodeJS and NPM ● Newman command line tool ● Git NOTE: these tools should be installed on your CI server (e.g. Jenkins)
  11. 11. Jenkins job configuration
  12. 12. Jenkins plugins to install ● Email Extension Plugin ● Git plugin (in most cases is installed by default)
  13. 13. Steps for adding Jenkins job 1. Create job with desired name and “Freestyle project” type; 2. Enter URL for your git repository under “Source Code Management”; a. Add credentials in case you are using private git repository; b. Specify branch you would like to use (“master” by default) 3. Click on “Add Build Step” > “Execute shell” under “Build” section. 4. Type newman command to run collection (newman run <collection_file_name> -e <env_var_filename>) 5. Configure Email Notification under “Post-build actions” section. 6. Configure your deployment job to trigger
  14. 14. Jenkins. Create new job
  15. 15. Jenkins. Specify git repository
  16. 16. Jenkins. Add “Execute shell” build step
  17. 17. Jenkins. Enter newman command with path to collection file and file with environment variables
  18. 18. Jenkins. Configure Email Notification. Step 1
  19. 19. Jenkins. Configure Email Notification. Step 2
  20. 20. Jenkins. Configure Email Notification. Step 3
  21. 21. Jenkins. Configure Email Notification. Step 4
  22. 22. Jenkins. Configure Email Notification. Step 5
  23. 23. Is it the final step? Run it!
  24. 24. Jenkins. Console output
  25. 25. Jenkins. Console output
  26. 26. ● Open your existing Job (the one that is used for application deployment) ● Click on “Configure” ● Select “Build other projects” under “Post-build Actions” section ● Enter name of your job with newman command ● Save Trigger your new job from another
  27. 27. Jenkins. Post-build action to trigger job with Postman collection
  28. 28. What we have used? Summary of the tools used ● Postman for creating tests ● Newman for running them on server ● Git for storing your collections and variables’ file ● Jenkins to trigger newman command in certain conditions (after deployment, daily, on demand, etc)
  29. 29. ThanksQuestions? Example files used in presentation can be found at