Reference
Exit Codes

Exit Codes

The artillery CLI exits with a zero exit code when a test run completes successfully. If the test run fails, the CLI exits with a non-zero exit code.

Exit codes are how other programs can determine whether the artillery CLI succeeded or failed. For example, GitHub Actions and other CI systems use exit codes to determine whether to mark a job as successful or failed.

Non-zero exit codes

The artillery CLI will exit with a non-zero exit code in the following cases:

Test interrupted by the user

If the test run is interrupted by the user, Artillery exits with a non-zero exit code. This includes:

  • pressing Ctrl+C in the terminal
  • sending a SIGINT or SIGTERM signal to the process with the kill command
  • using Stop Test in the Artillery Cloud dashboard

Unrecoverable errors

Artillery will exit with non-zero exit code if it encounters an unrecoverable error and can't continue running the test. Unrecoverable errors include:

  • The test script is invalid (e.g. it contains a syntax error)
  • A dependency of custom JS/TypeScript code could not be loaded

For tests that run on AWS or Azure:

  • Artillery could not start the workers, e.g. due to insufficient IAM permissions, or a network error
  • A worker encountered an unrecoverable error and crashed
  • A worker ran out of memory and was terminated by the cloud provider

Explicit checks that fail

By default, Artillery will exit with zero if the test run completes, i.e. all virtual users start and finish executing their scenarios, and it will not take protocol-level errors (such as HTTP 5xx responses) or network errors (such as request timeouts) encountered by virtual users into account to determine the exit code. That means that if your test run produced a number of HTTP 500 responses, or if some requests timed out, Artillery will still exit with a zero exit code by default.

You can create explicit checks for specific conditions in your test script using the ensure plugin. If an ensure condition fails, Artillery will exit with a non-zero exit code. This is useful for running Artillery in CI/CD pipelines and other automated environments where you want to fail the CI job if a specific condition is not met.