k6 load testing

Assert on status codes under load

Medium70 pts~25 min
  • Status assertions
  • Error budgets
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-assert-on-status-codes-under-load

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

Objective

Put checkout under concurrent load and assert on every status code with an error-rate budget.

Your task

  1. 1Set options { vus: 10, iterations: 100 }.
  2. 2GET BASE_URL + "/perf/checkout" and check status === 200.
  3. 3Add thresholds 'http_req_failed': ['rate<0.02'] and 'checks': ['rate>0.98'].

Acceptance criteria

  • GET /perf/checkout returns 200
  • An error-rate threshold is declared
  • ≥ 100 requests with error rate < 2%
  • At least 95 check() calls pass

k6 load testing · Performance Testing · Assertions & validation