Skip to content

Setup

formatting...

Module contains step implementations that configures the load test scenario with parameters applicable for all scenarios.

Configuration value

Step to set configuration variables not present in specified environment file.

The configuration value can then be used in the following steps. If the specified name already exists, it will be overwritten.

Example

Given value for configuration "default.host" is "example.com"
...
Then log message "default.host=$conf::default.host$"

Arguments

Name Type Description Default
name str

dot separated name/path of configuration value

required
value str

configuration value, any $..$ variables are resolved, but {{ .. }} templates are kept

required

Log level

Configure log level for grizzly.

Default value is INFO, by changing to DEBUG there is more information what grizzly is doing behind the curtains.

Example

And log level is "DEBUG"

Arguments

Name Type Description Default
log_level str

one of INFO, DEBUG, WARNING, ERROR

required

Message type callback

Register a custom callback function for a custom message type, that should be sent from client/server to client/server (exclusive).

steps/custom.py
def my_custom_callback(env: Environment, msg: Message) -> None:
    print(msg)
Given register callback "steps.custom.my_custom_callback" for message type "custom_msg" from client to server

Arguments

Name Type Description Default
callback_name str

full namespace and method name to the callback function

required
message_type str

unique name of the message

required
from_node MessageDirection

server or client, exclusive

required
to_node MessageDirection

client or server, exclusive

required

Run time

Configure the time period a headless test should run for.

If available test data is infinite, the test will run forever if this step is not used.

Example

And run for maximum "1h"

Arguments

Name Type Description Default
timespan str

description of how long the test should run for, e.g. 10s, 1h, 40m etc.

required

Save statistics

Set an URL where locust statistics should be sent.

It has support for InfluxDB and Azure Application Insights endpoints.

For InfluxDB the following format must be used:

influxdb://[<username>:<password>@]<hostname>[:<port>]/<database>?TargetEnviroment=<target environment>[&Testplan=<test plan>]
[&TargetEnvironment=<target environment>][&ProfileName=<profile name>][&Description=<description>]

For Azure Application Insights the following format must be used:

insights://?InstrumentationKey=<instrumentation key>&IngestionEndpoint=<ingestion endpoint>[&Testplan=<test plan>]
insights://<ingestion endpoint>/?InstrumentationKey=<instrumentation key>[&Testplan=<test plan>]

Example

And save statistics to "influxdb://grizzly:secret-password@influx.example.com/grizzly-statistics"
And save statistics to "insights://?IngestionEndpoint=https://insights.example.com&Testplan=grizzly-statistics&InstrumentationKey=asdfasdfasdf="
And save statistics to "insights://insights.example.com/?Testplan=grizzly-statistics&InstrumentationKey=asdfasdfasdf="
And save statistics to "influxdb://$conf::statistics.username$:$conf::statistics.password$@influx.example.com/$conf::statistics.database$"

Arguments

Name Type Description Default
url str

URL for statistics endpoint

required

Wait spawning complete indefinitely

Step to make scenarios wait with execution until spawning is complete, without timeout.

This is when there are dependencies between scenarios. This will make all scenarios to wait until all defined users are spawned.

Example

Given wait until spawning is complete

Wait spawning complete timeout

Step to make scenarios wait with execution of tasks until spawning is complete, at most timeout seconds.

This is when there are dependencies between scenarios. This will make all scenarios to wait until all defined users are spawned.

Example

Given wait "13.37" seconds until spawning is complete

Arguments

Name Type Description Default
timeout float

number of seconds to wait until locust spawning is complete

required