Answer the question
In order to leave comments, you need to log in
Do I understand the essence of Tests in Postman correctly?
They asked me to write a couple of tests in postman. I didn’t even know that such a thing exists, but here are some of the examples that are in the postman template itself.
For example:
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
Answer the question
In order to leave comments, you need to log in
It doesn't matter where you write the tests. A test is an emulation of a certain situation and a comparison of the result obtained with the expected one. It doesn't matter if it's 200 or 400. You're sending a valid request and expecting to get 200 in response, if you get it, it's ok. You send a request with erroneous data and expect a 400 response, you received something else, which means fail. Because this is also incorrect behavior.
Another thing is that it is better to first cover standard behavior with tests, and not only return codes, but also data, and then exceptions, errors, and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question