Is there way\metrics to capture the start and end time of a particular test run?
Depending on what you mean by “start” time, here are some things you can do:
- get the current time outside of k6 (e.g. with a small shell script) and pass it to k6 as a k6 script environment variable
- get the current time and return in
setup()
- use the
scenario.startTime
property fromk6/execution
to get the start time of a single scenario (and/or the whole test, if it just has one scenario)
For the end time, it’s a similar situation, though a bit more limited. You can get the current time in teardown()
or handleSummary()
and use this inside of k6, or get the time in a shell script after k6 finishes running the whole test.
1 Like