When I specify vus or duration in k6, the default scenario is executed

Hi @Scble

Welcome to the community forum :wave:

When using duration as a CLI flag, you are actually using a shortcut for a single scenario with constant vus. You won’t be able to create more scenarios using that. And there is no way to specify the exec via CLI, so it takes the default. I find this a bit confusing as well so I’ll discuss this with the devs team.

Have a look at the options order of preference, and the options reference for more details.

If I understand correctly, this is similar to what we discussed in How to specify `rate` on CLI - #3 by immavalls2. Support for configuring scenarios via CLI flags is very limited, and it’s probably causing this unexpected behavior.

If you want to inform vus and duration for several scenarios, I would create custom environment variables to pass those and replace in the options. If you plan to have more than one scenario, the CLI flag won’t work for you anyway, and the issue to implement this is a bit complex: Support Scenarios in the CLI options · Issue #3054 · grafana/k6 · GitHub

I hope this helps :bowing_woman:

Cheers!

1 Like