Docs/Test Data & State

Variables

Variables let a single test run against different data or environments without duplicating it. Assrt resolves three namespaces at runtime: var, env, and secret.

Declaring variables

yaml
name: Update billing email
variables:
  new_email: billing@example.com

steps:
  - type:
      element: billing email input
      text: "{{ var.new_email }}"

Namespaces

  • {{ var.name }} — values declared inside the test.
  • {{ env.NAME }} — values from the process environment (CLI) or workspace environment (Cloud).
  • {{ secret.NAME }} — secret values, masked in logs and traces.

Overriding from the CLI

bash
assrt run tests/update-billing.yaml \
  --var new_email=qa+bill@example.com
Secrets stay in secret
Never put credentials or API keys in var. Use secret, which is masked everywhere it could otherwise leak.