A test is just a simple assertion in which you check a value from a response against an expected value. In this tutorial, we will create a simple test in Postman that checks if an API request is successfully executed without the need to check manually the Body response. It is important to note that tests only run after the request is completed.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
pm.test("Status code is 404", function () { pm.response.to.have.status(404); });