Validating HTTP responses
Talend Cloud API Tester allows you to test the behavior
of your APIs.
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
- Headers
- Body length
- Duration
- 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.
For example:
- Status code equals 200
- Duration (ms) less than 200
- Body content exists
- The element located at JSON path $.id in the JSON body equals 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.