API Execution with Newman and Postman

  
1) First Install Postman Click Here
  
2) Install Newman through Terminal ( mac user) or Command Prompt ( widnows user )  
   npm install -g newman  
  
3) Start Postman and Create collection with different requests
  
   Click on + icon to create new collection . Add name for collection
   
   
4) Create some GET , POST request under the collection a) GETwithParamerization Request:- {{url}}/users
Add some assertions points undert the Test section
Click on eye icon to set envirnoment varibale for parameterization varibale = url Initial value= https://jsonplaceholder.typicode.com
b) GET
c) POST Body-> JSON [ { "id": "55", "name": "Krishna Rungta", "username": "Bret", "email": "Sincere@april.biz", "address": { "street": "Kulas Light", "suite": "Apt. 556", "city": "Gwenborough", "zipcode": "92998-3874", "geo": { "lat": "-37.3159", "lng": "81.1496" } }, "phone": "1-770-736-8031 x56442", "website": "hildegard.org", "company": { "name": "Romaguera-Crona", "catchPhrase": "Multi-layered client-server neural-net", "bs": "harness real-time e-markets" } } ]
5) Run Collection Click on three dots icons -> select run collection-> Run Postman collection. We can get result
6) Run Collection through Newman Click on collection three dots icon-> Export-> save it into folder ( postman ) . Ex file name " PsotmanTestCollection.postman_collection.json" Click eye icon-> Click on global edit button-> Export-> save it into folder ( postman ) Ex. file name "MyWorkspace.postman_globals.json" Open terminal -> Go to the folder where above mentioned file downloaded earlier Enter following command newman run PsotmanTestCollection.postman_collection.json -e MyWorkspace.postman_globals.json Result can look like below