Skip to content
Latchkey

artillery run: Usage, Options & Common CI Errors

artillery run executes a YAML-defined load scenario and checks SLOs.

Artillery describes load tests in YAML with phases and scenarios. Its CI gate is the ensure block (or --ensure plugin): if a latency/error SLO is breached, artillery exits non-zero.

What it does

artillery run reads a YAML config defining a target, load phases (arrivalRate/duration), and scenarios of requests, then generates traffic and reports aggregate metrics. ensure conditions assert SLOs and fail the run when violated.

Common usage

Terminal
artillery run scenario.yml
artillery run -e staging scenario.yml          # use a named environment
artillery run -o report.json scenario.yml
artillery run --overrides '{"config":{"target":"https://staging"}}' scenario.yml
artillery report report.json                    # render an HTML report

Options

FlagWhat it does
-e <name>Select a config.environments entry
-o <file>Write the JSON results report
--overrides <json>Override config values inline
-t <target>Override the target URL
config.ensureSLO thresholds that fail the run

Common errors in CI

When an ensure threshold (e.g. p95 or maxErrorRate) is breached, artillery prints "ensure condition failed" and exits 1 - the intended SLO gate. Without ensure, artillery exits 0 even with errors, so add ensure for CI. "ECONNREFUSED" or "errors.ECONNREFUSED: N" in the report means the target is down. A YAML indentation mistake yields "Error: config.phases is required". Note artillery quick is for ad hoc runs; artillery run with a config is the CI path.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →