Skip to main content
QA Training
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 maintainable 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

How to use this prompt

  1. 1Copy the prompt template using the Copy button above.
  2. 2Open your preferred AI assistant (ChatGPT, Claude, Gemini, Copilot, etc.).
  3. 3Paste the prompt and replace the {{placeholder}} variables with your project-specific values.
  4. 4Review the output - treat it as a professional first draft, not a final deliverable.
  5. 5Iterate: refine the output by asking follow-up questions or providing more context.

Frequently asked questions

Which AI models work best with this prompt?v

This prompt works with any capable language model including ChatGPT (GPT-4o), Claude (3.5+), Gemini (1.5 Pro+), and GitHub Copilot Chat. More capable models produce more complete and accurate outputs.

How do I adapt the prompt for a different framework?v

Replace the framework placeholder with your target framework and update any framework-specific syntax references in the output. The structure and logic of the generated tests will transfer across frameworks.

Can I use this prompt commercially?v

Yes. All prompts on QATraining.uk are free to use for personal and commercial QA work. Attribution is appreciated but not required.