Saturday, August 22, 2020

Postman tool API testing All

Postman tutorial:

https://www.softwaretestingmaterial.com/postman-tutorial/


Postman assertion:
https://learning.postman.com/docs/writing-scripts/script-references/test-examples/



Pre-requisite script

var random_number1=_.random(1, 100);
var core_Url=pm.environment.get("baseUrl");
var token="Bearer "+pm.environment.get("token") ;
console.log(tok);
const echoPostRequest = {
  url: core_Url+'/api/bookstore',
  method: 'POST',
  header: {
      'content-type':'application/json',
      'Authorization':token
  },
  Authorization:tok ,
  body: {
        mode: 'application/json',
        raw: JSON.stringify
        ({
        "code": "Postman updated"+random_number1,
        "name": "API Postman"+random_number1,
        "description": "ADMT some deee ",
        "sla": "5",
        "enabled": true,        
        "metadata": [],        
        "serviceAccess": ["Public", "Commercial" ],
        "requiredDocuments": []
        })
    }   
};
 
pm.sendRequest(echoPostRequest, function (err, res) {
    console.log("new");
    console.log(err);
    console.log(res);
    //console.log(err ? err : res.json());
    //const dataresponse= res.json();
    //pm.environment.set("ServiceFor_update",dataresponse.data.id);
});






YouTube: 
Raghav pal link

https://www.youtube.com/playlist?list=PLhW3qG5bs-L-oT0GenwPLcJAPD_SiFK3C




Node js Newman command line arguments
newman run collection.json -environment enviornment.json --globals global.json

Passing environment variables in cmd prompt

https://github.com/postmanlabs/newman/blob/develop/README.md#command-line-options

newman run <collection file> -e <environment file>

https://stackoverflow.com/questions/50843024/postman-collection-is-passing-in-postman-runner-but-not-its-failing-in-command


https://learning.postman.com/docs/running-collections/using-newman-cli/command-line-integration-with-newman/


How to run multiple collection in newman:

https://community.postman.com/t/required-to-run-multiple-collection-through-newman/10792/5



https://www.npmjs.com/package/newman-reporter-htmlextra

npm install -g newman-reporter-htmlextra

newman run collection.json -r htmlextra



Exact Steps:


1.      Install Nodejs(https://nodejs.org/en/download/)  : Admin rights required.
2.      Install newman  plugin

3.      Install html extra reporter plugin




Run Collection












No comments:

Post a Comment

JMeter Simple Controller

  Simple Controller is just a  container  for user request.