Postman test cases on Jenkins

 1. Download and install postman - https://www.postman.com/downloads/ 

 2. Open postman and click on collection 

    Create new folder and start writing test cases -   






This will generate test suit for you ( postman collection for test cases )

3. Click on Environments and add key, value pair for the environment variables 

Example - We can specify environment details here so that same test case by changing env can be executed on multiple environments like - DEV, QA, UAT and PRD 

4. Now export postman collection and environment 

  1.     postman.collection.testcases.json 
  2.     postman.collection.env.json

5. Now install node js - https://nodejs.org/en/download

Install below node packages also - 

  1.     sudo npm install -g newman
  2.     sudo npm install -g newman-reporter-htmlextra

6. Now go to the folder where postman collection and environment json are store 
7. Run below commands - 

newman run postman.collection.testcases.json -e postman.collection.env.json -r htmlextra --reporter-htmlextra-export ./results/TEST-API.html


The above command will execute the postman collection and will generate HTML report for you. 

Now create a new job in Jenkins and add these command with postman collection.

Now all API test cases with execute automatically as per cron jobs on Jenkins 


Comments

Popular posts from this blog

What’s the Difference Between Docker and Kubernetes?

TestNG Listeners

Database Sharding