Load Testing with k6
A practical k6 workflow against the Pizza Playground, from install to a full load model. This track follows Performance Testing Fundamentals — read that first if you have not already, the test types and NFR vocabulary carry straight into the scripts here.
Important: This track is in progress, written and validated against k6 v2.2.0. Every code sample lives in
k6/sample/and the status table below says which pages have been run for real against a running playground and which have not.
The Sample Project
Everything shown in these pages runs from the sample project. Download it, unzip it, and run from the k6/sample folder inside. The Sample Project page lists every script and -e switch.
⬇ Download the k6 sample (.zip)
The zip is rebuilt from k6/sample/ in the repository every time the site is built, so it always matches these pages.
unzip k6-sample.zip
cd k6/sample
k6 run 01-first-test.js
Status
| Page | Written | Validated | Screenshots |
|---|---|---|---|
| 1. Install Tools | Yes | Yes | No |
| 2. Understand Requirements | Yes | Yes | N/A |
| 3. k6 Concepts | Yes | Yes | N/A |
| 4. Recording | Yes | Yes | No |
| 5. Auth, Correlation and Data | Yes | Yes | No |
| 6. Checks and Thresholds | Yes | Yes | No |
| 7. Debug | Yes | Yes | No |
| 8. Load Model | Yes | Validated (scaled) | No |
| 9. Execute and Analyze | Yes | Validated (scaled) | No |
| 10. Reporting | Yes | Validated (scaled) | No |
| 99. Sample Project | Yes | Yes | none needed |
| 99. Future / To Explore | Yes | n/a | none needed |
Basics
| # | Topic | Description |
|---|---|---|
| 1 | Install Tools | The k6 binary, Docker image, and running the first script |
| 2 | Understand Requirements and Flow | Turning NFRs into thresholds, executors and VUs |
| 3 | k6 Concepts | Lifecycle, VUs vs. iterations, options vs. CLI vs. env vars |
| 4 | Recording | Record a HAR with Playwright codegen, convert it with har-to-k6, and why a green replay can lie |
| 5 | Auth, Correlation and Data | Logging in, correlating ids, SharedArray test data |
| 6 | Checks and Thresholds | Pass/fail criteria inside the script |
| 7 | Debug | Making a failing script tell you why |
Applying Load
| # | Topic | Description |
|---|---|---|
| 8 | Load Model | Stages, executors and profiles from the Performance Testing module |
| 9 | Execute and Analyze Results | Running scripts and reading the summary and output |
| 10 | Reporting | Communicating findings |
Appendix
| Topic | Description | |
|---|---|---|
| Sample Project | Download the runnable sample, what is inside, and every -e switch | |
| Future / To Explore | Grafana Cloud output, the browser module, xk6 extensions |