K6 load tests — Part III

Kavita Jadhav
2 min readNov 13, 2023

--

stdout logs configurations

https://www.istockphoto.com

The below sample test and configs were added in Part II.

import http from 'k6/http';
import {check} from 'k6';

export default function () {
let res = http.get('http://test.k6.io');
check(res, {
'success response': (result) => result.status === 200,
'body contains text': (result) => result.body.includes('Collection of simple web-pages suitable for load testing.')
})
};
{
"vus": 2000,
"iterations": 5000,
"duration": "30s"
}

The command to run these tests is:

k6 run test.js --config load-test-config.json

Stdout logs for the test run include test information, progress, errors, test run summary etc which might require endless scrolling. You may not need these logs in the CI environment where you run performance tests.

These logs can be controlled with --quiet and --log-output flags.

quiet: flag is used to disable printing test information to stdout. It will not disable verbose logs.

k6 run --quiet test.js --config load-test-config.json

log-output: variable is used to control stdout logs. When log-output is set to none, it will stop printing verbose(log, info, debug, warn, error) logs. error and warning messages. other supported values include stdout, file, loki etc. More information is available here.

k6 run --log-output=none test.js --config load-test-config.json

Together these flags can be used to print test execution summary in the stdout logs.

k6 run --quiet --log-output=none test.js --config load-test-config.json

Let’s have a look at a few more configurations in Part IV.

Note: Subsequent parts of the series are available here.

Happy Testing!

--

--