-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add composite scenario capabilities (#26)
- Loading branch information
Showing
3 changed files
with
222 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,54 @@ | ||
example_scenario_1: | ||
test_file_name: 'test_example.py' | ||
test_file_name: test_example.py | ||
grasshopper_args: | ||
users: 1 | ||
spawn_rate: 1 | ||
runtime: 200 | ||
grasshopper_scenario_args: | ||
foo : 'bar2' | ||
foo : bar1 | ||
thresholds: | ||
get google images: | ||
type: get | ||
limit: 2000 | ||
tags: | ||
- 'smoke' | ||
- 'example1' | ||
- smoke | ||
- example1 | ||
|
||
example_scenario_2: | ||
test_file_name: 'test_example.py' | ||
test_file_name: test_example.py | ||
grasshopper_args: | ||
users: 2 | ||
spawn_rate: 1 | ||
runtime: 300 | ||
grasshopper_scenario_args: | ||
foo: 'bar3' | ||
foo: bar2 | ||
thresholds: | ||
get google images: | ||
type: get | ||
limit: 2500 | ||
percentile: 0.8 | ||
tags: | ||
- 'smoke' | ||
- 'example2' | ||
- smoke | ||
- example2 | ||
|
||
example_scenario_composite: | ||
grasshopper_args: | ||
users: 10 | ||
spawn_rate: 1 | ||
runtime: 200 | ||
child_scenarios: | ||
- scenario_name: example_scenario_1 | ||
weight: 1 | ||
grasshopper_scenario_arg_overrides: | ||
foo: bar3 | ||
- scenario_name: example_scenario_2 | ||
weight: 3 | ||
grasshopper_scenario_arg_overrides: | ||
foo: bar4 | ||
thresholds: | ||
get google images: | ||
type: get | ||
limit: 4000 | ||
percentile: 0.7 | ||
tags: | ||
- composite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Module: test_gh_composite. | ||
The generalized test function for running composite journeys in Grasshopper. | ||
""" | ||
import os | ||
|
||
import grasshopper.lib.util.listeners # noqa: F401 | ||
from grasshopper.lib.grasshopper import Grasshopper | ||
|
||
FILE_PATH = os.path.basename(__file__) | ||
|
||
|
||
def test_run_composite( | ||
complete_configuration, | ||
composite_weighted_user_classes, | ||
): | ||
"""The generalized test function for running composite journeys in Grasshopper.""" | ||
for user_class in composite_weighted_user_classes.keys(): | ||
user_class.update_incoming_scenario_args(complete_configuration) | ||
locust_env = Grasshopper.launch_test( | ||
composite_weighted_user_classes, **complete_configuration | ||
) | ||
return locust_env |