Graphs in HTML report

Hi,

Wondering if it’s possible to tweak the html reporter to add graphs (response times and requests per second mainly) to the result generated at the end of the test.
My current workaround is to simultaneously send the results to NewRelic where I’m able to get graphs of for each test run. Does anyone have a simpler solution?

Hi there!

That’s not really possible with the HTML reporter, since it uses the handleSummary() function to render the aggregated data typically shown by k6 at the end of a test run. This data doesn’t have the granular metric samples required to render graphs.

Here’s an example of what it contains: summary.json (2.4 KB)

Sending metric samples to a backend like New Relic isn’t really a workaround, but the recommended way to use k6 if you want to see granular test results and render graphs.

One thing you can try is to use an extension like xk6-dashboard. This is essentially a k6 output that exposes a web app that renders metric data locally, and shows you nice graphs. It’s, of course, much less flexible than working with a metrics backend where you can customize the graphs and build any type of visualization that you want, but it’s a great and quick way to visualize test results without using a separate service. We’ve been discussing whether it makes sense to make such a feature a core part of k6, but in the meantime, you might find this extension useful.

Another option worth considering is our Docker Compose setup. This is a relatively simple way of starting local instances of InfluxDB and Grafana, and to run tests that send results to InfluxDB, and are rendered in the pre-configured Grafana dashboard. There’s more complexity and moving parts in this case, but you’d get a fairly flexible metrics pipeline without having to configure anything manually.

Cheers!

1 Like

Thanks for your detailed response.

Your recommendations look great but I’m currently running my tests on a remote linux machine (with no display). I’m not sure how I’d be able to view the results. I wonder if it’s possible to send those server side events (re the xk6 dashboard) directly to my pc, instead of locally on my remote machine. I’ll have to look into that.

Thanks again

xk6-dashboard starts a web server at the configured address (127.0.0.1:5665 by default). So if you change this to run on a public interface, you should be able to access it remotely via your local web browser. A display is not needed on the remote machine.

Just make sure to set some firewall rules on that port if you’re accessing over the internet.

1 Like