How can I use handleSummary and print the summary on console at the same time?

I use handleSummary to save the test result, and at the same I want to check the result on the console.
But the console output is disappered if I used handleSummary.
Can I use both of them?

Hi @peter!

Welcome on the support forum :tada:

You can definetly use both of them, and I think our documentation does not do a good enough job in demonstrating how, indeed, at the moment. As described here, the object returned from the handleSummary controls where the data will be written. Thus, by including a stdout or stderr key that’s set to the value of the textSummary function (which comes from an external JS lib), you will still output the report’s summary as before :+1:

Here’s a minimal example:

import http from 'k6/http'
import { textSummary } from ''

export const options = {
    duration: '30s',

export default function () {

export function handleSummary(data) {
    // Manipulate the data, and upload to S3 for instance.

    // then
    return {
        // Write the summary to stdout
        stdout: textSummary(data, { indent: ' ', enableColors: true }), // Show the text summary to stdout...

Let me know if that’s helpful, and if you have other questions :bowing_man:

Thanks, bro.
It solved my problem.

1 Like