Parameterize test data from a file
Medium70 pts~25 min
- Parameterisation
- Test data
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
Feed each iteration different search terms and SKUs from a data set instead of one hardcoded value.
Your task
- 1Paste the data file as an inline array: [{ q: "mug", sku: "TQA-100" }, { q: "tee", sku: "TQA-200" }, { q: "hoodie", sku: "TQA-300" }, { q: "sticker", sku: "TQA-500" }].
- 2Pick a row with data[(__VU + __ITER) % data.length].
- 3GET BASE_URL + "/perf/search?q=" + row.q and check status 200 and that results is non-empty.
- 4Use { vus: 4, iterations: 20 }.
Acceptance criteria
- GET /perf/search returns 200
- Rows are selected via __VU/__ITER
- No open()/SharedArray
- ≥ 20 requests are sent
- At least 20 check() calls pass
Constraints
- open() and SharedArray are not available in the runner — embed the file content as an inline array.
k6 load testing · SDET · Scripting basics