Run your k6 test locally
Run the script on your machine and read the terminal summary.
This is the first concrete win in the path: k6 executes the default function, collects metrics, and prints results without requiring cloud infrastructure.
To run your k6 test locally, complete the following steps:
Open your terminal and navigate to the directory containing your
script.jsfile.Run the k6 test using the following command:
k6 run script.jsIf you’re using Docker instead of a native installation, run the command from the directory that contains
script.js(the<passes the script into the container):docker run --rm -i grafana/k6 run - < script.jsObserve the test execution in your terminal. k6 displays progress information, including:
- Current iteration count
- HTTP request statistics
- Response time metrics
- Data transfer information
- Any errors or failures
Review the test summary when the test completes. Look for:
- Total test duration
- Number of iterations completed
- HTTP request statistics (total requests, successful requests, failed requests)
- Response time metrics (average, minimum, maximum, p90, p95 — where p95 means 95% of requests were faster than this value)
- Data transfer metrics (data sent, data received)
- Checks and thresholds status (if configured)
You should see output similar to:
TOTAL RESULTS checks_total.......................: 10 13.122179/s checks_succeeded...................: 100.00% 10 out of 10 checks_failed......................: 0.00% 0 out of 10 ✓ status was 200 HTTP http_req_duration..............: avg=123.45ms min=98.12ms med=120.00ms max=156.78ms
p(90)=148ms p(95)=150ms http_req_failed…………….: 0.00% 0 out of 10 http_reqs………………….: 10 1.67/s
EXECUTION
iteration_duration.............: avg=1.12s min=1.10s med=1.11s max=1.15s p(90)=1.14s
p(95)=1.14s iterations…………………: 10 1.67/s
NETWORK
data_received..................: 15 kB 2.5 kB/s
data_sent......................: 1.0 kB 168 B/s
If the test fails to run or you encounter errors, check that your script syntax is correct and that you have network connectivity to the target URL. For more help, refer to the k6 documentation on running tests.
In the next milestone, you’ll send these test results to Grafana Cloud to visualize them in dashboards and analyze performance trends over time.