A k6 load test can generate a ton of data. Without a way to organize the data, you'll struggle to analyze test results.
Fortunately, there are many ways to turn results into data-rich visualizations.
If a test is useful, it has results that we can interpret. Without meaningful output, it doesn't matter how elegant or optimized the test-script code is. Besides, as the size of the load test increases, interpreting results becomes harder and harder—so much data!
When dealing with huge data points, graphics are an invaluable tool. Instead of parsing thousands of individual data points, images let you see the broad patterns at a glance.
In last week's office hours, developer advocates Nicole and Paul demonstrated ways to visualize k6 results. They covered some methods that k6 officially supports, and highlighted some community contributions, too.
One flexible way to turn results into visualizations is to use the k6 built-in outputs. For example, to direct output to CSV, run your script with the --out option:
(For JSON output, just replace csv with json).
From here, you can use the tool of your choice to process my_test_result.csv into a visual chart. You could use NumPy, Tableau, Excel, et cetera. Anything that can ingest CSV or JSON will work.
There are multiple community-driven ways to create an HTML dashboard.
The xk6-dashboard extension lets you export metrics to a Prometheus-like dashboard.
Whereas xk6-dashboard makes a k6 extension, k6 reporter uses an import in your test script.
Our developer advocate Paul demo'd a few ways to use Grafana as a dashboard front end. He set up a few docker images, demonstrating how to set up a dashboard with backends for:
To try, checkout the repo he made.
Finally, we can't talk about visualizing k6 without mentioning k6's own cloud offering. When you run a test on k6 cloud, k6 automatically generates a time-series graph.
If you don't have a cloud subscription, there's also a k6-cloud Grafana plugin, which does a pretty good imitation. Having multiple options is all part of our big-tent philosophy.
At the low level, each k6 test is just a stream of bytes. It's important that k6 lets you use this stream to represent data as you want to. So, you have many options to visualize the data how it best suits your analysis.
If you decide to make your own visualization tool, let us know! We love to hear about what the community is up to.