Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ellomas.com/llms.txt

Use this file to discover all available pages before exploring further.

Assertions

Assertions validate that step outputs match expected values. They catch regressions early and document the expected behaviour of your system.

Basic Syntax

Each assertion rule specifies a path to target, an operator, and an expected value.
assert:
  - ["$.status", "eq", 200]
  - ["$.data.name", "eq", "Alice"]
  - ["$.data.items", "not_null"]
You can also use the object form:
assert:
  - path: $.status
    op: eq
    value: 200
  - path: $.data.email
    op: not_null

Assertion Operators

OperatorAliasesTypeDescription
eq==, =AnyEqual (type-aware for numbers)
ne!=, <>AnyNot equal
gt>NumericGreater than
lt<NumericLess than
ge>=NumericGreater than or equal
le<=NumericLess than or equal
containsStringTarget contains substring
inArrayValue exists in array
not_nullAnyValue is not null

JSONPath in Assertions

Assertions use the same JSONPath syntax as extraction:
- name: validate-response
  type: http
  request:
    method: GET
    url: /users/42
  assert:
    - ["$.status", "eq", 200]
    - ["$.data.email", "contains", "@"]
    - ["$.data.verified", "eq", true]
    - ["$.data.roles", "contains", "admin"]
    - ["$.data.roles", "in", "admin"]
    - ["$.data.loginCount", "gt", 0]

Variables in Expected Values

Expected values can reference state variables:
- name: set-expected
  type: shell
  command: 'echo "{\"expected_name\": \"Bob\"}"'
  extract:
    target_name: $.expected_name

- name: check-assertion
  type: shell
  command: 'echo "{\"name\": \"Bob\"}"'
  assert:
    - ["$.name", "eq", "{{ target_name }}"]

Assertions on Different Step Types

HTTP

- name: api-check
  type: http
  request:
    method: GET
    url: /health
  assert:
    - ["$.status", "eq", 200]
    - ["$.data.status", "eq", "healthy"]

Shell

- name: output-check
  type: shell
  command: 'echo "{\"status\": \"ok\", \"count\": 5}"'
  assert:
    - ["$.status", "eq", "ok"]
    - ["$.count", "lt", 10]

Database

- name: db-check
  type: db
  query: "SELECT count(*) as cnt FROM users"
  assert:
    - ["$[0].cnt", "gt", 0]

Ignoring Assertion Failures

Combine with ignore_error to allow optional assertions:
- name: optional-check
  type: http
  request:
    method: GET
    url: /optional-endpoint
  assert:
    - ["$.status", "eq", 200]
  ignore_error: true

How Assertions Work

  1. The step executes and produces a result value
  2. The assertion engine resolves {{ variables }} in expected values
  3. If a path is specified, it resolves the JSONPath against the result
  4. The operator compares the resolved value against the expected value
  5. If the comparison fails, the step is marked as failed (unless ignore_error)
The assertion engine is type-aware for numeric comparisons: "5" == 5 evaluates to true.

What’s Next?