k6-load-testing

Write and execute k6 load tests for HTTP APIs, WebSockets, and browser scenarios.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill k6-load-testing-duccuong159
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: k6-load-testing
Source: https://github.com/DucCuong159/Realtime-chatapp/tree/main/.agent/skills/k6-load-testing
Command: npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill k6-load-testing-duccuong159

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Validating system performance under realistic traffic conditions is difficult without structured load tests, and teams often ship code without knowing whether it meets SLA requirements or where it breaks under stress. ## Core Features & Use Cases - Scenario-Based Load Testing: Configure smoke, load, stress, spike, and soak tests with VU stages, ramp-up/ramp-down, and SLA thresholds like p(95) response time and error rates. - Multi-Protocol Coverage: Test HTTP APIs with request chaining and parameterized data, WebSocket endpoints, and real browser flows using k6's Chromium integration. - CI/CD Integration: Run performance regression tests in GitHub Actions or GitLab CI with threshold-based pass/fail gates and JSON/InfluxDB/Prometheus result exports. - Use Case: Before deploying a new API version, run a k6 load test with 100 virtual users for 5 minutes, assert that 95% of requests complete under 500ms, and fail the pipeline if error rates exceed 1%. ## Quick Start Write a k6 load test that simulates 50 virtual users hitting my API's login and profile endpoints for two minutes with a p95 latency threshold of 500ms.

Frequently Asked Questions about k6-load-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a k6 load test for an HTTP API?

Import k6/http, define options with vus and duration or stages, then issue requests in the default function and validate responses with check(). Add thresholds like http_req_duration p(95)<500 to enforce SLA targets.

How to run k6 load tests in GitHub Actions CI?

Use the grafana/k6-action in a workflow step, then run k6 with your test script and pass secrets as environment variables. Threshold failures cause k6 to exit non-zero, failing the pipeline automatically.

Can k6 test WebSocket and browser scenarios?

Yes. k6/ws supports WebSocket connections with event handlers for messages and timeouts, while k6/browser drives real Chromium sessions for page navigation, clicks, and selector waits.

How do I parameterize k6 tests with CSV or JSON data?

Load files with open() inside a SharedArray so data is parsed once and shared across virtual users. Index entries with __VU or pick random items to simulate varied user behavior.

Why does k6 run out of memory during large tests?

Memory exhaustion usually comes from loading large datasets per VU or too many virtual users. Use SharedArray for shared data, reduce VU counts, or increase limits with the --max-memory flag.