You can test your API by using Assertions to verify that a certain part of an HTTP response matches your expectations. You can define assertions against the following response characteristics:
- Status code
- Body length
- Status message
- JSON body (using JSON Path)
- XML body (using Xpath)
- Body content
Assertions are validated in real-time, meaning that they are re-evaluated when you run the request and when you update them.
Assertions leverage operators in order to compare values and check the existence or inclusion of certain values.
Status codeequals 200
Duration (ms)less than 200
- The element located at JSON path
JSON bodyequals 12345
Assertions are a solid base to test your API, but you need them to be dynamic. Dynamic assertions allow you to test that the header
Content-type of the
response is equal to the header
Accept of the request for example. You can create dynamic assertions with expressions.