k6 --once runs the configured scenario once
Introduced 2026-09-21 · score 0.98
HOW TO USE IT
When debugging a script with at most one configured scenario, run `k6 run --once script.js` to execute its function once with one VU and one iteration while preserving scenario settings, including browser settings.
k6 run --once <script.js>WHY THIS HELPS
When debugging a script with one configured scenario, run its function once while retaining its browser configuration.
BEFORE THIS CHANGE
Shortcuts such as `--vus 1 --iterations 1` replaced the script’s scenarios with a default scenario, potentially discarding the selected function and browser options.
REQUIREMENTS AND LIMITATIONS
- Version: v2.3.0
- --once (required): Runs one iteration with one VU. For one configured scenario, uses `shared-iterations` and preserves its function and settings; executor timing defaults are applied.
- <script.js> (required): Path to the script to run.
- Supports scripts with at most one scenario.
FIRST-PARTY EVIDENCE
- https://github.com/grafana/k6/releases/tag/v2.3.0
- https://grafana.com/docs/k6/v2.3.x/using-k6/k6-options/reference/
Check the installed version and the source before using it. Entry JSON