DEV Community

Matt11Moriarty
Matt11Moriarty

Posted on

Postman Tests

From my Udemy course: [https://www.udemy.com/course/postman-the-complete-guide/]

Learned how to test my HTTP Requests and Collections.
Enjoyed putting my rudimentary JavaScript skills to work while building my tests.

`//Constant Defined
const response = pm.response.json();
//Tests
pm.collectionVariables.set('productId', response.id);
console.log(pm.collectionVariables.get('productId'));

pm.test("Status code is 200", () => {
pm.response.to.have.status(200);
});`

Top comments (0)