Postman asserts

What is an assertion

When we perform any test, there is an expectation, and this expectation is reflected in the program as an assertion. Common development languages have testing frameworks that implement assertions. Many frameworks are called Assert.

The Test in the postman

Postman provides very powerful programmability, after the interface runs, you can continue to run the scripts in Test. Scripts are written in javascript. Let’s look at the Test section first:

How do I assert a value in response to json

Let’s use the example of querying a user’s GET request. Let’s review this interface:

Modify based on this example

summary

Today, I gave you a brief introduction to the use of Test, which allows you to assert your response. So we don’t have to look at the response every time we run it, we just look at the assertion.

Series of entrance