Skip to content

Instantly share code, notes, and snippets.

@PramodDutta
Created September 8, 2024 05:44
Show Gist options
  • Save PramodDutta/ec775b2b507690b166298890e6718233 to your computer and use it in GitHub Desktop.
Save PramodDutta/ec775b2b507690b166298890e6718233 to your computer and use it in GitHub Desktop.
Postman Testcases Writing notes
console.log("After running the API")
console.log("Testcases written by Us")
console.log(pm.info.requestName);
// Postman Syntax for Text is based on the ChaiJS
console.log(pm.response.text()); // text response
console.log(pm.response.json()); // json response
console.log(pm.response.code); // 200
console.log(pm.response.status); // OK
console.log(pm.response.headers); // Headers
console.log(pm.response.cookies); // Cookies
Assertion
An assertion is a statement or declaration that is made confidently and emphatically,
Expected Result = Actual Result
Pura JS
pm.test("Verify that status code for the request is 200 Ok", function(){
pm.expect(pm.response.code).to.be.equal(200);
// pm.expect(AR).to.be.equal(ER);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment