The normal way to start scenarios one after the other is by using startTime.
Some scenarios (like shared-iterations, per-vu-iterations) can take unknown time to finish.
Is it possible to delay a scenario to only start after the previous one ends, if the previous one take unknown time to finish?
Not at the moment, sorry, startTime
is the only way to specify when a scenario should start
We’d like to eventually add support for a startAfter: 'otherScenarioName'
option, but there are tricky implementation issues before we can do that. You can follow Test suites / execute multiple scripts with k6 · Issue #1342 · grafana/k6 · GitHub for details and updates on that topic.
My suggestion is:
A new batchIndex: number
can be added
If it is provided, then scenarios with the same value will run together, startTime will be relative to the start of this batch. All scenarios without this value will be considered to have a value of 0.
If you like this design, I can contribute it, as this feature is quite useful in our use cases.
@alireza, can you please explain a little bit more how batchIndex
will work? The shared-iterations
and per-vu-iterations
can still take an unknown amount of time to finish. The biggest reason we haven’t implemented startAfter
is that k6 needs to calculate how many VUs might be needed to run the test at any given point in time, see this comment in the issue.
Ok. To know why this is hard to implement in k6, I need to read some code, to understand why time of everything needs to be known in advance. Without this knowledge, it appears that implementing stages/scenarios that start after other ones are finished should not be a difficult task.
Let me spend some time reading code and see if I understand the problem.
1 Like