What are k6 thresholds, and how do they help automate performance testing?
Answer
k6 thresholds are explicit pass/fail conditions over metrics, for example a maximum error rate and p95 or p99 response-time limit. A breached threshold makes the run fail, so a performance objective or SLO can become an automated quality gate rather than a graph someone must inspect manually. Thresholds should come from real requirements or an agreed baseline, not arbitrary numbers chosen to make CI green.
Strong answer includes
- defines thresholds as metric pass/fail criteria
- uses percentile latency and error-rate examples
- derives limits from SLOs, requirements or a controlled baseline
Practical example
A checkout gate might require `http_req_failed` below 1% and `p(95)` under the agreed latency budget. The pipeline then fails automatically if either objective is breached.