k6 is a developer-centric load testing tool written in Go with a JavaScript API. Thresholds define pass/fail SLO criteria on aggregated metrics, while checks are per-request assertions. Executors control virtual user lifecycle patterns for different load testing scenarios.
0 / 5 completed
1 / 5
A developer configures a k6 threshold: http_req_duration: ['p(95)<500']. What does this mean?
The threshold p(95)<500 means the 95th percentile of HTTP request duration must be below 500 milliseconds. If more than 5% of requests take 500ms or longer, the threshold fails and k6 exits with a non-zero status code, failing the CI pipeline.
2 / 5
What is a k6 Check and how does it differ from a Threshold?
Checks are inline assertions like check(response, { 'status is 200': r => r.status === 200 }) that run during the test against individual responses. Thresholds evaluate aggregated metrics (like check pass rate or percentile latency) at the end of the test to determine overall pass/fail.
3 / 5
A k6 test uses import { sleep } from 'k6' and calls sleep(1) between requests. What is the purpose of this sleep?
sleep() in k6 simulates user think time — the pause between user actions in real-world usage. Without sleep, virtual users make requests as fast as possible, creating unrealistic load patterns. Including think time makes load tests more representative of actual user behavior.
4 / 5
Which k6 executor should a developer use to maintain a constant number of active virtual users throughout the test?
The constant-vus executor maintains a fixed number of virtual users for the entire test duration. ramping-vus linearly increases/decreases VUs over time, shared-iterations distributes a fixed number of iterations across VUs, and per-vu-iterations runs each VU a fixed number of times.
5 / 5
A k6 script exports a handleSummary function. What does this function enable?
handleSummary() receives the aggregated test data after the test completes and allows custom processing of results. You can return objects with file paths to write JSON or HTML reports, or send results to external systems like InfluxDB or Datadog. This is k6's primary mechanism for custom reporting.