No results for

Powered byAlgolia


suggest edits

🎉 New in v0.27.0

This feature is new as of version 0.27.0. Usage of this feature is optional and for the vast majority of users, existing scripts and configurations will continue to work as before. For a list of breaking changes, see the k6 v0.27.0 release notes.

Scenarios allow us to make in-depth configurations to how VUs and iterations are scheduled. This makes it possible to model diverse traffic patterns in load tests. Benefits of using scenarios include:

  • Multiple scenarios can be declared in the same script, and each one can independently execute a different JavaScript function, which makes organizing tests easier and more flexible.
  • Every scenario can use a distinct VU and iteration scheduling pattern, powered by a purpose-built executor. This enables modeling of advanced execution patterns which can better simulate real-world traffic.
  • They can be configured to run in sequence or parallel, or in any mix of the two.
  • Different environment variables and metric tags can be set per scenario.


Execution scenarios are primarily configured via the scenarios key of the exported options object in your test scripts. The key for each scenario can be an arbitrary, but unique, scenario name. It will appear in the result summary, tags, etc.

1export const options = {
2 scenarios: {
3 example_scenario: {
4 // name of the executor to use
5 executor: 'shared-iterations',
7 // common scenario configuration
8 startTime: '10s',
9 gracefulStop: '5s',
10 env: { EXAMPLEVAR: 'testing' },
11 tags: { example_tag: 'testing' },
13 // executor-specific configuration
14 vus: 10,
15 iterations: 200,
16 maxDuration: '10s',
17 },
18 another_scenario: {
19 /*...*/
20 },
21 },


Executors are the workhorses of the k6 execution engine. Each one schedules VUs and iterations differently, and you'll choose one depending on the type of traffic you want to model to test your services.

Possible values for executor are the executor name separated by hyphens.

Shared iterationsshared-iterationsA fixed amount of iterations are
"shared" between a number of VUs.
Per VU iterationsper-vu-iterationsEach VU executes an exact number of iterations.
Constant VUsconstant-vusA fixed number of VUs execute as many
iterations as possible for a specified amount of time.
Ramping VUsramping-vusA variable number of VUs execute as many
iterations as possible for a specified amount of time.
Constant Arrival Rateconstant-arrival-rateA fixed number of iterations are executed
in a specified period of time.
Ramping Arrival Rateramping-arrival-rateA variable number of iterations are
executed in a specified period of time.
Externally Controlledexternally-controlledControl and scale execution at runtime
via k6's REST API or the CLI.

Common options

executor(required)stringUnique executor name. See the list of possible values in the executors section.-
startTimestringTime offset since the start of the test, at which point this scenario should begin execution."0s"
gracefulStopstringTime to wait for iterations to finish executing before stopping them forcefully. See the gracefulStop section."30s"
execstringName of exported JS function to execute."default"
envobjectEnvironment variables specific to this scenario.{}
tagsobjectTags specific to this scenario.{}