Record and replay a scenario
Medium70 pts~25 min
- Scenario scripting
- User journeys
Practice app · Checkout Service
A load-testable checkout service with realistic latency that degrades under concurrency, plus a live metrics view.
Your starter code already declares BASE_URL — call the API relative to it.
Objective
Script a recorded user journey — login, search, add to cart, checkout — as a replayable k6 flow.
Your task
- 1POST BASE_URL + "/perf/login" with JSON.stringify({ username: "qa@target.dev", password: "Test@123" }) with Content-Type: application/json and read token and csrf.
- 2GET BASE_URL + "/perf/search?q=mug".
- 3POST BASE_URL + "/perf/cart" with { sku: "TQA-100", qty: 1 }, headers Authorization: Bearer <token> and X-CSRF-Token: <csrf>.
- 4GET BASE_URL + "/perf/checkout"; check status 200 on every step. Use { vus: 2, iterations: 6 }.
Acceptance criteria
- All four journey requests return 200
- At least 24 check() calls pass
k6 load testing · Performance Testing · Scripting basics