k6 load testing

Fail a run on a threshold breach

Medium70 pts~25 min
  • Thresholds
  • Pass/fail criteria
Practice app · Checkout Service

A load-testable checkout service with realistic latency that degrades under concurrency, plus a live metrics view.

BASE_URL
/api/practice
Console app
/lab/performance-testing-fail-a-run-on-a-threshold-breach

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Make the run fail automatically when latency or errors exceed their budgets.

Your task

  1. 1Set options { vus: 5, iterations: 50 }.
  2. 2thresholds: 'http_req_duration': [{ threshold: 'p(95)<600', abortOnFail: true }], 'http_req_failed': ['rate<0.01'].
  3. 3GET BASE_URL + "/perf/checkout", check status 200.

Acceptance criteria

  • GET /perf/checkout returns 200
  • Thresholds are declared
  • ≥ 50 requests with p95 < 800 ms and error rate < 1%

k6 load testing · Performance Testing · Assertions & validation