Functional / smoke test

Validation & CI

loadr doubles as a functional tester: walk a table of cases once (feeder with on_eof: stop), assert each response, and exit non-zero if a single check fails. Drop it into CI as a contract / smoke gate — no separate framework.

Browse all 52 demos 12 categories
Run it
$ loadr run examples/41-functional-test.yaml
examples/41-functional-test.yaml
# Functional / smoke testing — Artillery's `functional-testing-with-expect` +
# `table-driven-functional-tests`.
#
# loadr doubles as a functional tester: make one pass over a table of cases
# (data feeder with `on_eof: stop`), assert each response, and let the run exit
# non-zero if a single check fails (`checks: rate>=1.0`). Drop it straight into
# CI as a contract/smoke gate — no separate test framework needed.
#
#   loadr run examples/41-functional-test.yaml   # exit code 99 on any failed check
name: functional-test
description: one pass over a case table, fail the run on any failed assertion

defaults:
  http:
    base_url: https://api.example.com

data:
  cases:
    type: csv
    path: data/users.csv
    mode: shared
    on_eof: stop      # one pass over the table, then the VU retires

scenarios:
  smoke:
    executor: shared-iterations
    vus: 4
    iterations: 1000   # upper bound; the feeder stops the run at table size
    flow:
      - request:
          name: login
          method: POST
          url: /login
          body: { form: { username: "${data.cases.username}", password: "${data.cases.password}" } }
          checks:
            - { type: status, equals: 200 }
            - { type: jsonpath, expression: "$.token", exists: true }
      - request:
          name: whoami
          url: /me
          headers: { Authorization: "Bearer ${token}" }
          checks:
            - { type: status, equals: 200 }
            - { type: jsonpath, name: identity, expression: "$.username", equals: "${data.cases.username}" }

thresholds:
  # Functional mode: every check must pass or the run fails (non-zero exit).
  checks: [ "rate>=1.0" ]

View raw: examples/41-functional-test.yaml

What it shows

  • Table-driven cases from a feeder
  • on_eof: stop = exactly one pass
  • checks: rate>=1.0 → exit 99 on any failure

Key metrics: checks.