π 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.