Setup
formatting...Module contains step implementations that setup the load test scenario with parameters that is going to be used in the scenario they are defined in.
Any failed task custom
Set behavior when specific failure occurs for any tasks in the scenario.
It can be either a str
or an exception type, where the later is more specific.
Example
When any task fail with "504 gateway timeout" retry task
When any task fail with "RuntimeError" stop user
When any task fail with "TaskTimeoutError" retry task
Arguments
Name | Type | Description | Default |
---|---|---|---|
failure
|
type[Exception] | str
|
exception type or exception message that should be handled |
required |
failure_action
|
FailureAction
|
how the specified failure should be handled |
required |
Any failed task default
Set default behavior when latest task fail.
If no default behavior is set, the scenario will continue as nothing happened.
Example
Arguments
Name | Type | Description | Default |
---|---|---|---|
failure_action
|
FailureAction
|
default failure action when nothing specific is matched |
required |
Iteration pace
Set minimum time one iterations of all the tasks in the scenario should take.
E.g. if pace
is set to 2000
ms and the time since it last ran was 300
ms, this task will
sleep for 1700
ms. If the time of all tasks is greater than the specified time, there will be
an error, but the scenario will continue.
This is useful to be able to control the intensity towards the load testing target.
Example
Arguments
Name | Type | Description | Default |
---|---|---|---|
pace_time
|
str
|
number of milliseconds each iteration at max should take, supports templating |
required |
Iterations
Set how many iterations the tasks in the scenario should execute.
Default value is 1
. A value of 0
means to run until all test data is consumed, or that the (optional) specified
runtime for the scenario is reached.
Example
And repeat for "10" iterations
And repeat for "1" iteration
And value for variable "leveranser" is "100"
And repeat for "{{ leveranser * 0.25 }}" iterations
Arguments
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
number of iterations of the scenario, can be a templatning string or a environment configuration variable |
required |
Log all requests
Metadata
Set a metadata (header) value to be used by the user when sending requests.
When step expression is used before any tasks has been added in the scenario the metadata will be used for all requests the specified loadtesting user executes in the scenario.
If used after a Request task, the metadata will be added and only used for that request.
If used after a task that implements grizzly.auth.GrizzlyHttpAuthClient
(e.g. HTTP client task),
the metadata will be added and only used when that task executes.
Example
And metadata "Content-Type" is "application/xml"
And metadata "Ocp-Apim-Subscription-Key" is "9asdf00asdf00adsf034"
Or, for use in one request only, specify metadata after the request:
Set variable alias
Create an alias for a variable that points to another structure in the context.
This is useful if you have test data that somehow should change the behavior for a user, e.g. username and password.
Example
And value for variable "AtomicCsvReader.users" is "users.csv | repeat=True"
And set alias "auth.user.username" for variable "AtomicCsvReader.users.username"
And set alias "auth.user.password" for variable "AtomicCsvReader.users.password"
Variables in payload templates are not allowed to have an alias.
Arguments
Name | Type | Description | Default |
---|---|---|---|
alias
|
str
|
which node in the context that should get the value of |
required |
variable
|
str
|
an already initialized variable that should be renamed |
required |
The failed task custom
Set behavior when specific failure occurs for the latest task.
It can be either a str
or an exception type, where the later is more specific.
Example
...
When the task fails with "504 gateway timeout" retry task
When the task fails with "RuntimeError" stop user
When the task fails with "TaskTimeoutError" retry task
Arguments
Name | Type | Description | Default |
---|---|---|---|
failure
|
type[Exception] | str
|
exception type or exception message that should be handled |
required |
failure_action
|
FailureAction
|
how the specified failure should be handled |
required |
The failed task default
Set default behavior when the latest task fails.
If no default behavior is set, the scenario will continue as nothing happened.
Example
Arguments
Name | Type | Description | Default |
---|---|---|---|
failure_action
|
FailureAction
|
default failure action when nothing specific is matched |
required |