What is the difference between a check/assertion and a threshold in a load test, and how do thresholds gate a build?
Last updated
A check/assertion validates a single response (e.g. status
200, body content). A failed check is recorded but does not fail the test by itself.A threshold is a pass/fail rule on an aggregated whole-run metric (e.g.
p(95)<500, error rate under 1%), encoding the SLA/SLO.A breached threshold makes the tool exit non-zero, so CI/CD fails the step and blocks the merge or deploy. Thresholding the check pass rate (e.g.
checks: rate>0.99) lets correctness gate the build too.
- https://qaskills.sh/blog/k6-thresholds-checks-complete-guide
- https://grafana.com/docs/learning-hub/k6-performance-testing/03-establishing-a-baseline/18-checks-vs-thresholds/
- https://blog.nashtechglobal.com/lets-know-about-checks-and-thresholds-in-k6/
- https://grafana.com/docs/k6/latest/using-k6/thresholds/
- https://grafana.com/docs/learning-hub/k6-performance-testing/01-intro/02-what-is-perf-testing/
- https://grafana.com/docs/k6/latest/using-k6/checks/