You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You currently can't get them directly, sorry, though with some simple workarounds, you might be able to get what you need. You can get the total duration/iteration/etc. options by returning them from setup() like this:
This works because the consolidated k6 options (CLI flags + env vars + JS options + JSON options) will be propagated back to the JS options object before the setup() or VU execution. So, running that script with k6 run --vus 5 --duration 20m and then running curl http://localhost:6565/v1/setup will get you something like:
You can get the current VUs (useful for when you have ramping up or down of VUs via stages) via curl http://localhost:6565/v1/status or curl http://localhost:6565/v1/metrics/vus. However, there isn't a metric for the current elapsed test duration, and while you can probably create a custom one that you update in the script, you might be better off with just an external timer.
I'll leave this issue open, since it makes sense to have these directly and in a single place the API, but because of the somewhat easy workarounds, it's definitely going to be a low priority one. And it's definitely going to be after #1007 is merged, because otherwise we'd have to do it twice...
How can i get the current and total duration/iterations of a load testing from the rest api?
The text was updated successfully, but these errors were encountered: