Disable the test execution information at console.log

How can I disable the running message during test execution?
Where do I check the overall start time and end time of the test execution?

    |18-Dec-2019 13:26:53|                   __   ___   __      |
    |18-Dec-2019 13:26:53|     /\  /  \     |  |_/  /  / /      |
    |18-Dec-2019 13:26:53|    /  \/    \    |      |  /  ‾‾\    |
    |18-Dec-2019 13:26:53|   /          \   |  |‾\  \ | (_) |   |
    |18-Dec-2019 13:26:53|  / __________ \  |__|  \__\ \___/ .io|
    |18-Dec-2019 13:26:53||
    |18-Dec-2019 13:26:53|    init [----------------------------------------------------------] runner|
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------] options|
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------] executor|
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------]   engine|
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------]   collector|
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------]   server|
    |18-Dec-2019 13:27:47|  execution: local|
    |18-Dec-2019 13:27:47|     output: json=./result/benchmark.json|
    |18-Dec-2019 13:27:47|     script: accept-case.js|
    |18-Dec-2019 13:27:47||
    |18-Dec-2019 13:27:47|    duration: -, iterations: 1|
    |18-Dec-2019 13:27:47|         vus: 1, max: 1|
    |18-Dec-2019 13:27:47||
    |18-Dec-2019 13:27:47|    init [----------------------------------------------------------] starting|
    |18-Dec-2019 13:27:48|time="2019-12-18T13:27:48+08:00" level=info msg=Running i=0 t=862.139393ms|**
    |18-Dec-2019 13:27:49|time="2019-12-18T13:27:49+08:00" level=info msg=Running i=0 t=1.862154194s|
    |18-Dec-2019 13:27:50|time="2019-12-18T13:27:50+08:00" level=info msg=Running i=0 t=2.862142606s|
    |18-Dec-2019 13:27:51|time="2019-12-18T13:27:51+08:00" level=info msg=Running i=0 t=3.862148452s|
    |18-Dec-2019 13:27:52|time="2019-12-18T13:27:52+08:00" level=info msg=Running i=0 t=4.862139845s|
    |18-Dec-2019 13:27:53|time="2019-12-18T13:27:53+08:00" level=info msg=Running i=0 t=5.86215557s|
    |18-Dec-2019 13:27:54|time="2019-12-18T13:27:54+08:00" level=info msg=Running i=0 t=6.86215387s|
    |18-Dec-2019 13:27:55|time="2019-12-18T13:27:55+08:00" level=info msg=Running i=0 t=7.862150182s|
    |18-Dec-2019 13:27:56|time="2019-12-18T13:27:56+08:00" level=info msg=Running i=0 t=8.862154963s|
    |18-Dec-2019 13:27:57|time="2019-12-18T13:27:57+08:00" level=info msg=Running i=0 t=9.862135128s|
    |18-Dec-2019 13:27:58|time="2019-12-18T13:27:58+08:00" level=info msg=Running i=0 t=10.862142182s|
    |18-Dec-2019 13:27:59|time="2019-12-18T13:27:59+08:00" level=info msg=Running i=0 t=11.862136953s|
1 Like

You can silence that with the --quiet CLI flag, though I’m not sure if we even need to show this debug message when running on a non-TTY stdout… Seems like something we might fix in https://github.com/loadimpact/k6/pull/1007 (cc @imiric)

Edit: made a note of this in Improve the new CLI UI (multi-progressbar alignments and sizing, etc.) · Issue #1279 · grafana/k6 · GitHub

Yeah, this is working well with the -quiet CLI flag.

Any idea where to find overall start time and end time of the test execution from stdout?

You mean the whole k6 run command or each test iteration?

Yeah.

Probably the sample below:-

          /\      |‾‾|  /‾‾/  /‾/   
     /\  /  \     |  |_/  /  / /    
    /  \/    \    |      |  /  ‾‾\  
   /          \   |  |‾\  \ | (_) | 
  / __________ \  |__|  \__\ \___/ .io

  execution: local
  script: sample.js

  duration: -,  iterations: 1
  vus: 1, max: 1

  start data time: xxxxxx
    
  xxxxxx
  xxxxxx
  xxxxxx
  iterations.........................: 10      0.01163/s
  vus................................: 1       min=1 max=1
  vus_max............................: 1       min=1 max=1

  end data time: xxxxxx

Not sure exactly what you’re trying to do, but you can approximate the test start and end time by measuring when setup() and teardown() are executed: Test lifecycle

import { sleep } from "k6";

export function setup() {
    console.log("start data time: " + (new Date()));
}

export default function () {
    sleep(1); // do something
}

export function teardown() {
    console.log("end data time: " + (new Date()));
}

And instead of logging them to the console, you can use custom Gauge metrics to measure the precise timestamps: Metrics , Gauge

1 Like