Skip to main content

Captures and Assertions

Response Captures

& body -> $VAR_NAME
& body.token -> $TOKEN := fallback
& body.items[0].name -> $VAR_NAME
& json(body.result.content[0].text).items[0].id -> $ITEM_ID
& header.content_type -> $CONTENT_TYPE
& status -> $STATUS

Use captures to thread values into later requests, assertions, and callbacks.

Dependency response captures are also supported:

&[Dependency Request].body -> $VAR_NAME
&[Dependency Request].status -> $STATUS

Dependency response captures require the referenced request to be declared in > requires: so the planner can guarantee the upstream result exists.

Append := default_value to a capture when you want a fallback if the selected path is missing.

Assertions

^ & body.field == 'value'
^ & body.total === NUMBER
^ & json(body.result.content[0].text).items[0] ~= {"id":"123"}
^ $STATUS == 200

Supported operators include:

  • == and !=
  • ~=
  • ===
  • > >= < <=

Bare true, false, and null are typed literals. Quoted values remain strings.

Structural Matching

~= supports:

  • substring or regex matching for strings
  • partial object matching for JSON object literals
  • unordered membership for array-vs-scalar JSON matches
  • unordered subset matching for JSON array literals

== and != compare structured JSON values structurally when both sides resolve to arrays or objects.

Schema Validation

=== validates the left-hand JSON value against a built-in or declared schema target.

  • the right-hand side must be a declared target name
  • the left-hand side must be a typed JSON operand

Use NUMBER when you want a concise built-in target for any JSON number.

Guards And Labels

# The page loads
^ & status == 200

[ FEATURE_ENABLED == true ] ^ & body.user.id == "123"
  • # ... labels the next assertion only
  • [predicate] guards assertions and fragment imports
  • === is not supported inside guards

Blank lines or other request items break the label association. A false assertion guard marks that assertion as skipped.