For more information about API Checks in general, see our API Check article.
An Assert Step makes an assertion on two values. To make an assertion, supply two parameters along with the comparison that you would like to perform between the two.
We currently support 3 types of comparisons: string, numeric, and regular expression. For string and numeric comparisons, values are coerced to the comparison type before the comparison is made. For a regular expression comparison, the first parameter is a string and the second parameter is a regular expression.
The comparisons that are currently available are:
|is not empty|
|is less than|
|is less than or equal to|
|does not contain|
|does not equal|
|is greater than|
|is greater or equal to|
|is less than (numeric)|
|is greater than or equal to (numeric)|
|matches (regular expression)|
|does not match (regular expression)|
Please note that the
is empty and
is not empty comparisons are string comparisons. An empty JSON object or array,
, is stored as a string and will not be empty.
An Assert Step will fail if the assertion is false when the step is run.
In the example below, we make a request and then make three assertions. The first two assert steps claim that the response code is between 200 and 299 inclusive. The final step asserts that the response body contains the string
I'm feeling lucky.