Skip to content

User

This module contains step implementations that describes a Load User.

Given type count tag

Given "{user_count}" {grammar:UserGramaticalNumber} of type "{user_class_name}" with tag "{tag}" load testing "{host}"

[view_source]

Set which type of Load User the scenario should use, which host is the target, how many users that should be spawned and an associated tag.

Users with the same tag value will run on the same set of workers, which will be exclusive for users with the same tag value.

Example:

Given "1" user of type "RestApi" with tag "foo" load testing "..."
Given "10" users of type "MessageQueue" with tag "foo" load testing "..."
Given "5" users of type "ServiceBus" with tag "bar" load testing "..."
Given "1" user of type "BlobStorage" with tag "bar" load testing "..."

Arguments:

  • user_count int - Number of users locust should create
  • user_class_name str - name of an implementation of Load User, with or without User-suffix
  • tag str - unique string to "stick" user types to a set of exclusive workers
  • host str - an URL for the target host, format depends on which Load User is specified

Given type count

Given "{user_count}" {grammar:UserGramaticalNumber} of type "{user_class_name}" load testing "{host}"

[view_source]

Set which type of Load User the scenario should use, which host is the target and how many users that should be spawned.

Example:

Given "1" user of type "RestApi" load testing "..."
Given "10" users of type "MessageQueue" load testing "..."
Given "5" users of type "ServiceBus" load testing "..."
Given "1" user of type "BlobStorage" load testing "..."

Arguments:

  • user_count int - Number of users locust should create
  • user_class_name str - name of an implementation of Load User, with or without User-suffix
  • host str - an URL for the target host, format depends on which Load User is specified

Given type with weight

Given a user of type "{user_class_name}" with weight "{weight_value}" load testing "{host}"

[view_source]

Set which type of Load User the scenario should use and which host is the target, together with weight of the user (how many instances of this user should spawn relative to others).

Example:

Given a user of type "RestApi" with weight "2" load testing "..."
Given a user of type "MessageQueue" with weight "1" load testing "..."
Given a user of type "ServiceBus" with weight "1" load testing "..."
Given a user of type "BlobStorage" with weight "4" load testing "..."

Arguments:

  • user_class_name str - name of an implementation of Load User, with or without User-suffix
  • weight_value str - weight value for the user, default is 1 (see writing a locustfile)
  • host str - an URL for the target host, format depends on which Load User is specified

Given type

Given a user of type "{user_class_name}" load testing "{host}"

[view_source]

Set which type of Load User the scenario should use and which host is the target.

Example:

Given a user of type "RestApi" load testing "http://api.example.com"
Given a user of type "MessageQueue" load testing "mq://mqm:secret@mq.example.com/?QueueManager=QMGR01&Channel=Channel01"
Given a user of type "ServiceBus" load testing "sb://sb.example.com/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123def456ghi789="
Given a user of type "BlobStorage" load testing "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=examplestorage;AccountKey=xxxyyyyzzz=="

Arguments:

  • user_class_name str - name of an implementation of Load User, with or without User-suffix
  • host str - an URL for the target host, format depends on which Load User is specified