Overview
When your k6 test completes, a summary is automatically generated and displayed in the console. This summary includes aggregated metrics, threshold results, check failures, and group statistics. The summary output collects metrics data throughout the test run using a periodic flusher that aggregates samples every 200ms by default.Summary Components
Test Run Duration
The total duration of the test execution, including setup and teardown time.Metrics Display
All observed metrics are displayed with their aggregated values:- Counter metrics: Total count and rate per second
- Gauge metrics: Current, min, max, and average values
- Rate metrics: Percentage of non-zero values
- Trend metrics: min, max, avg, med, p(90), p(95), p(99) by default
You can customize which trend statistics are displayed using the
summaryTrendStats option in your test configuration.Threshold Results
The summary shows the pass/fail status for each defined threshold:Check Statistics
For each check in your test, the summary displays:- Number of passes
- Number of failures
- Pass rate percentage
Group Metrics
When using groups in your test, the summary can display per-group metrics depending on the summary mode.Summary Modes
k6 supports different summary modes that control the level of detail:Legacy Mode
The original summary format showing only top-level metrics.Compact Mode
A concise summary without group-level details. This is useful for tests with many groups.Extended Mode
Displays detailed metrics for each group and scenario, creating a hierarchical view of your test structure.Configuration
You can configure summary behavior in your test:Implementation Details
The summary output (internal/output/summary/summary.go:22) implements the Output interface and:
- Collects samples during test execution via
AddMetricSamples() - Stores samples in a data model organized by metrics, groups, and scenarios
- Tracks check pass/fail counters atomically
- Generates the final summary structure when
Summary()is called