Assertions

The assertions you can write, and how to point them at a response.

An assertion has a type, a property, and usually a value. property points at a saved reply. Start with the request name, then add the path to the field you care about.

status_code is different: set property to the request name itself (for example get_products), not a field inside the JSON body.

AssertionValue TypeDescription
is_equalsAnyThe field matches value.
is_not_emptyN/AA list or string has content, or an object has fields. Numbers and true/false always pass.
is_greater_thanNumberThe field is greater than value.
is_less_thanNumberThe field is less than value.
containsAnyThe field is a list that includes value.
has_propertyStringThe object has a field named value.
status_codeNumberThe response HTTP status matvches value.
assertions:
  - type: status_code
    property: get_products
    value: 200
  - type: has_property
    property: get_products
    value: products
  - type: is_not_empty
    property: get_products.products
  - type: contains
    property: get_products.products[0].tags
    value: beauty
  - type: is_equals
    property: get_products.products[0].id
    value: 1
  - type: is_greater_than
    property: get_products.products[0].price
    value: 0
  - type: is_less_than
    property: add_product.price
    value: 1000

contains only works on lists. Using it on a string or object fails.