Chai Assertion Library
pm.test("Test Name", ()=> {
// (Assertion) ;
}
);
Response Validation
- Status Code
- Headers
- Cookies
- Response Time
- Response Body
Testing Status Code
Test For the Response Status Code
pm.test("Status Code is 200 " , ( ) = > {
pm.response.to.have.status(200);
});
pm.test("Status code is 201", ( ) = > {
pm.response.to.have.status(201);
});
If you want to test being one of the set then include then int an array and use of them
pm.test("Successful Post Request " ( ) =>{
pm.expect(pm.response.code).to.be.of([201,202]);
});