When a test finishes, k6 prints a top-level overview of the aggregated results to stdout.
Besides this default summary, k6 can output the results in other formats at the end of the test:
On this page | Result format | Read about... |
---|---|---|
Custom summary | Aggregated | Using the handleSummary() to make completely custom reports |
CSV | Time-stamped data points | Writing results as a CSV file, and the structure of the data |
JSON | Time-stamped data points | Writing results as a JSON file, and the structure of the data |
The default summary
The end-of-test summary reports details and aggregated statistics for the primary aspects of the test:
- Summary statistics about each built-in and custom metric (e.g. mean, median, p95, etc).
- A list of the test's groups and scenarios
- The pass/fail results of the test's thresholds and checks.
Above's an example of a report that k6 generated after a test run.
- It has a scenario, Ramp_Up
- The requests are split into two groups:
- GET home, which has a check that responses are 200 (all passed)
- Create resource, which has a check that responses are 201 (all failed)
- The test has one threshold, requiring that 95% of requests have a duration under 200ms (failed)
Summary options
k6 provides some options to filter or silence summary output:
- The --summary-trend-stats option defines which Trend metric statistics to calculate and show.
- The --summary-time-unit option forces k6 to use a fixed-time unit for all time values in the summary.
- The --no-summary option completely disables report generation, including --summary-export and handleSummary().
Summary export to a JSON file
k6 also has the --summary-export=path/to/file.json option, which exports some summary report data to a JSON file.
The format of --summary-export is similar to the data parameter of the handleSummary() function. Unfortunately, the --summary-export format is limited and has a few confusing peculiarities. For example, groups and checks are unordered, and threshold values are unintuitive: true indicates the threshold failed, and false that it succeeded.
We couldn't change the --summary-export data format, because it would have broken backward compatibility in a feature that people depended on in CI pipelines. But, the recommended approach to export to a JSON file is to use the handleSummary() function]. The --summary-export option will likely be deprecated in the future.