All Prompts
advanced
k6 Load Test Script with Staged Ramp-Up
Generate a k6 load test script with staged ramp-up, custom metrics, thresholds, and CI integration.
Prompt Template
You are a performance engineer specialising in load testing with k6.
Generate a production-grade k6 load test script for {{targetUrl}} with:
Scenario: {{scenarioDescription}}
Peak concurrent users: {{peakUsers}}
Test duration: {{duration}} minutes
SLA thresholds: p95 < {{p95ThresholdMs}}ms, error rate < {{errorRatePercent}}%
Script requirements:
1. Staged ramp-up: warm-up (10% load) → ramp (50%) → peak (100%) → ramp-down
2. Realistic user behaviour with think times (sleep between requests)
3. Custom metrics: track checkout conversion rate, search latency
4. Thresholds that fail the test if SLA is breached
5. HTTP request groups named by user flow step
6. Environment variable support for base URL and auth tokens
7. Correlation of dynamic values (extract tokens, IDs from responses)
8. VU-isolated state (no shared mutable state between VUs)
9. JSON results output for CI parsing
10. Summary report with key percentiles
Include a GitHub Actions step that runs k6 in Docker and fails the pipeline if thresholds are breached.Tags
performance
k6
load-testing
thresholds
sla