Skip to content

Response Assertion

Response Assertion Post Processors lets you check that the HTTP responses satisfies one or several conditions.

Response Assertion

Location

response-assertion-location

This section lets you decide on which part of the HTTP Response this Response Assertion is going to apply.

Selecting Others opens a list of less common criteria that you can also use.

Values to check

The response assertion can be applied to one or more values. It is possible to either use the picker or directly enter the value to assert.

When using the picker, keep in mind you can switch from recorded to validate using the Source select box.

Body

This option opens the recorded response body and allows you to select the value you want to assert.

response-assertion-body

Headers

The header picker is slightly different since it allows selection of a particular header and will copy <Name>: <Value> in the Response assertion.

response-assertion-header

Status code

This option is focused the HTTP response code:

response-assertion-response-code

Others

When dealing with other types of locations, or if you've already picked a value, it is also possible to edit the value directly in the field.

Warning

Be extra careful since all Regexp reserved characters must be escaped for Contains and Matches Matching rules.

Behavior

Response Assertion behavior

Applies to

This option allows you to apply this response assertion on the main request and/or children of the main request.

Note

This is only relevant if the parent HTTP Request action has the Download resources/Follow redirects option enabled. Otherwise there will not be any children request.

Matching rule

  • Contains: true if the text contains this value, can use regular expressions,
  • Matches: true if the whole text matches this value, can use regular expressions,
  • Equals: true if the whole text equals the pattern string (usually in combination with the Status Code Location),
  • Substring: true if the text contains the pattern string.

Negate pattern

Select Yes to reverse the search. This can be useful to check you do not have an error message.

Assume success

At runtime, any 4XX or 5XX response code will fail the corresponding response. Activating this option will make the status of this response a success, whatever the response code was. It will also override the result of previous assertions. Make sure to only use it on the first assertion of a given request.

This option doesn't require a Value to check to be provided. If you do add one, it will be applied on top of the assume succes, so the assertion may still result in a failed status, if this value cannot be found.

Example usage:

  • Ignore all response codes for a particular request,
  • Decide if the response is a success independently from the response.

Warning

When running a validation, we will also compare the response code to the recorded request. Because of this the status of the response may still be failed.

Debug

Opening the debug panel allows you to quickly see the result of your assertion. Make sure to check it every time you make a significant change:

response-assertion-debug