With this plugin Artillery can validate if a metric meets a predefined threshold or condition. You can create simple checks, e.g. that p95
response time is <250ms, or more complex conditions which are based on several metrics.
If an ensure
check fails Artillery will exit with a non-zero exit code. This is useful in CI/CD pipelines for automatic quality checks and as a way to check that SLOs are met.
Docs: https://www.artillery.io/docs/guides/guides/test-script-reference#ensure---slo-checks
In the following example, we set three ensure
checks:
- The first one checks that HTTP response time
p95
is <= 1000ms, with athreshold
check - The second one uses a more complex conditional expression, and checks that HTTP response time
p99
is less than 2000ms and that at least 10 virtual users were launched - The third check makes sure that all virtual user scenarios completed successfully
config:
target: "https://www.artillery.io"
plugins:
ensure: {}
phases:
- duration: 10
arrivalRate: 1
ensure:
thresholds:
- engine.http.response_time.p95: 1000
conditions:
- expression: engine.http.response_time.p99 < 2000 and core.vusers.created.total > 10
strict: false
- expression: core.vusers.failed == 0
scenarios:
- flow:
- get:
url: "/"
- get:
url: "/docs"
- get:
url: "/integrations"
MPL 2.0