A predicate is a condition expression that evaluates a part of a response against an expectation. The result of a predicate is either true or false.


A predicate will always appear between a query and a value (such as an assert’s expectation). Here is a table of all supported predicates and their functions.

==Query and value are equal.status == 200
!=Query and value are not equal.status != 200
<Query is less than value.duration < 2000
<=Query is less than or equal to value.duration <= 2000
>Query is greater than value.header Content-Length > 0
>=Query is greater than or equal to value.jsonpath $.age >= 18
containsQuery contains value as a string.body contains Hello, World!
startswithQuery begins with value as a string.body startswith Hello
endswithQuery ends with value as a string.body endswith World!
matchesQuery matches value as a regular expressionbody matches ^Hello.+$
inQuery matches one of a set of valuesstatus in [ 200, 201 ]


Any predicate can be negated to achieve the opposite effect by using the not keyword. For example:

status not in [ 400, 500 ] # will succeed as long as the status is NOT 400 or 500