cURL to k6 Load Test — Convert a Real Request into a Performance Suite
Turn a single cURL into a full k6 load test: thresholds, checks, ramping VUs, and CI-friendly output. Includes a free cURL → k6 converter.
2026-07-17 · By Avinash Kamble, reviewed by Priyanka G.
The fastest path from "I want to load-test this endpoint" to "here is a passing k6 script running in CI" is capture a real cURL, convert to k6, add thresholds. Here is the full workflow.
Step 1 — capture cURL from DevTools
Open the target request in Chrome DevTools → Network → right-click → Copy → Copy as cURL. Paste into the cURL → Code Converter and pick "k6" as the target.
Step 2 — the generated k6 script
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
vus: 20,
duration: '2m',
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<800'],
},
};
export default function () {
const res = http.post('https://api.example.com/orders',
JSON.stringify({ productId: 42, qty: 2 }),
{ headers: { 'Content-Type': 'application/json',
'Authorization': `Bearer ${__ENV.API_TOKEN}` } });
check(res, { 'status is 201': (r) => r.status === 201 });
sleep(1);
}Step 3 — ramping VUs for realistic traffic
export const options = {
stages: [
{ duration: '30s', target: 10 },
{ duration: '2m', target: 50 },
{ duration: '30s', target: 0 },
],
};Step 4 — export results
k6 run --out json=result.json script.js
k6 run --out influxdb=http://localhost:8086/k6 script.jsStep 5 — gate in CI
k6 exits non-zero when thresholds fail. Add it as a GitHub Actions step and PR checks fail automatically when p95 regresses.
Frequently asked questions
1.Does k6 support GraphQL?
2.How many VUs can a single k6 machine run?
3.Should I randomise data?
4.Can I convert an entire Postman collection?
Practice these questions
Run a live QA mock interview tailored to this topic and get per-skill scoring in minutes.
Was this article helpful?
More from k6 Load Testing
Grafana k6 — scripting, thresholds, scenarios.
Keep building your QA edge
Pillar guides- cURL to Code Converterconvert cURL to Postman, Playwright, or Rest AssuredConvert any cURL command to Postman, Playwright, Rest Assured, k6, Cypress, Python, and more — free, in-browser.
- JSON / JSONPath / JMESPath Testertest JSONPath and JMESPath side by sideDual-engine JSONPath + JMESPath tester with assertion builder and Postman/Playwright/Rest Assured export.
- Postman to Code ConverterSoftwareTestPilot's Postman-to-code converterConvert any Postman collection into a full Playwright, Rest Assured, k6, Cypress, Supertest, Python, or Karate test suite — folders, pm.test assertions, and environments preserved.
Continue reading

k6 vs JMeter in 2026: We Benchmarked Both on a Real Microservices App
13 min read
k6 Load Testing Tutorial 2026: From Zero to First Load Test (Step-by-Step)
18 min read
Performance Testing Interview Questions: JMeter, k6 & LoadRunner (2026)
12 min readJoin the QA Community
Connect with fellow testers, share job leads, and get career advice.
Stop Reinventing the Wheel. Upgrade Your QA Arsenal.
Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.
- Ready-to-use testing strategy templates
- Advanced API & UI automation guides
- ⏱️ Save 10+ hours a week on test planning