πŸ‘‘ Hierarchical ScenariosΒΆ

It may be the case that all your scenarios cannot be treated the same:

  • some only apply to a part of your load test target,
  • some should run more often than others.

For instance, the Zalando website works differently depending on its top-level domain: zalando.fr has an additional step before payment compared to zalando.de. This requires using different scenarios (i.e. different HAR files) depending on the tested domain. Moreover, to execute a realistic load test, we need to produce much more traffic targeting certain countries than others.

To accomodate this way of working, our HAR files are organized in country-specific directories, each of which is potentially associated to a specific weight according to the relative amount of traffic expected:

scenarios/
β”œβ”€β”€ Germany/
β”‚   β”œβ”€β”€ scenario_1.har
β”‚   β”œβ”€β”€ scenario_2.har
β”‚   └── scenario_2.weight
β”œβ”€β”€ Germany.weight
β”œβ”€β”€ Switzerland/
β”‚   └── scenario_1.har
└── Switzerland.weight

The weight files of directories (Germany.weight, Switzerland.weight) are similar to scenario weight files but apply to the whole directory (relatively to other directories of the same level). Thus, in the previous example, if Germany.weight is 6 and Switzerland.weight is 2, then Germany scenarios will be executed (in total) three times more (6 / 2) than Switzerland scenarios.

Just like for HAR files, a directory without a weight file has a default weight of 1.

Scenarios can be arbitrarily nested, allowing you to organize and weight them as you want:

scenarios/
β”œβ”€β”€ Germany/
β”‚   β”œβ”€β”€ beauty/
β”‚   β”‚   └── checkout.har
β”‚   β”œβ”€β”€ kids/
β”‚   β”‚   └── frontpage.har
β”‚   β”œβ”€β”€ kids.weight
β”‚   └── scenario_1.har
β”œβ”€β”€ Germany.weight
β”œβ”€β”€ Switzerland/
β”‚   └── scenario_1.har
└── Switzerland.weight

To represent this, Transformer will produce nested Locust TaskSets in the resulting locustfile.