k6 run has two different ways of showing the results of a load test. By default, we show an aggregated summary report at the end of the test. This report is customizable, but by default features a general overview of all groups, checks and thresholds in the load test, as well as aggregated values for all built-in and custom metrics used in the test run.
If the aggregated metric measurements are not enough and something more fine-grained is needed, k6 also supports streaming the raw metric values to one or more external outputs (e.g. InfluxDB, Kafka, StatsD, etc.) while the test is running. The raw results can also be sent to our managed k6 cloud service (e.g. when you want to test an environment behind a firewall) and they can be exported as a CSV or JSON file for later processing. All supported built-in outputs are listed below.
Standard output
When k6 displays the results to stdout, it will show the k6 logo and the following test information:
- Test details: general test information and load options.
- Progress bar: test status and how much time has passed.
- Test summary: the test results (after test completion). Since k6 v0.30.0, it is possible to completely customize the output and redirect it to a file. It is also possible to save arbitrary files with machine-readable versions of the summary, like JSON, XML (e.g. JUnit, XUnit, etc.), or even nicely-formatted HTML reports meant for humans! For more details, see the handleSummary() docs.
Test details
- execution: local shows the k6 execution mode (local or cloud).
- output: - is the output of the granular test results. By default, no output is used, only the aggregated end-of-test summary is shown.
- script: path/to/script.js shows the name of the script file that is being executed.
- scenarios: ... is a summary of the scenarios that will be executed this test run and some overview information:
- (100.00%) is the used execution segment
- 50 max VUs tells us up to how many VUs (virtual users) will be used across all scenarios.
- 5m30s max duration is the maximum time the script will take to run, including any graceful stop times.
- * default: ... describes the only scenario for this test run. In this case it's a scenario with a ramping VUs executor, specified via the stages shortcut option instead of using the scenarios long-form option.
End-of-test summary report
The test summary provides a general overview of your test results. By default, the summary prints to stdout the status of all:
- Aggregated values for the built-in metrics and custom metrics.
- Checks and thresholds.
- Groups and tags.
As of k6 v0.30.0, it's possible to completely customize the summary shown to stdout, redirect it to a file or stderr, or build and export your own completely custom report (e.g. HTML, JSON, JUnit/XUnit XML, etc.) via the new handleSummary() callback.
To learn more about the metrics k6 collects and reports, read the Metrics guide.
Output of trend metrics
Trend metrics collect trend statistics (min/max/avg/percentiles) for a series of values. On stdout they are printed like this:
You could use the summaryTrendStats option to change the stats reported for Trend metrics. You can also make k6 display time values with a fixed time unit (seconds, milliseconds or microseconds) via the summaryTimeUnit option. And, as mentioned above, you can completely customize the whole report via the handleSummary() callback.
Summary export
Additionally, the k6 run command can export the end-of-test summary report to a JSON file that includes all of the data above. This is useful to get the aggregated test results in a machine-readable format, for integration with dashboards, external alerts, etc.
This was first possible in k6 v0.26.0 with the --summary-export flag, though its use is now discouraged (see why here).
Instead, starting with k6 v0.30.0, the use of the handleSummary() callback is recommended, since it allows completely customizing the end-of-test summary and exporting the summary report data in any desired format (e.g. JSON, CSV, XML (JUnit/xUnit/etc.), HTML, TXT, etc.).
External outputs
If the aggregated end-of-test summary is insufficient, k6 can send more granular result data to different external outputs, to integrate and visualize k6 metrics on other platforms.
The available built-in outputs currently are:
Plugin | Usage |
---|---|
Amazon CloudWatch | k6 run --out statsd |
Apache Kafka | k6 run --out kafka |
Cloud | k6 run --out cloud |
CSV | k6 run --out csv |
Datadog | k6 run --out datadog |
InfluxDB | k6 run --out influxdb |
JSON | k6 run --out json |
New Relic | k6 run --out statsd |
StatsD | k6 run --out statsd |
Multiple outputs
You can simultaneously send metrics to several outputs by using the CLI --out flag multiple times, for example: