Skip to content

Latest commit

History

History
152 lines (93 loc) 路 3.4 KB

api.rst

File metadata and controls

152 lines (93 loc) 路 3.4 KB

API

User class

locust.User

HttpUser class

locust.HttpUser

TaskSet class

locust.TaskSet

task decorator

locust.task

tag decorator

locust.tag

SequentialTaskSet class

locust.SequentialTaskSet

Built in wait_time functions

locust.wait_time

HttpSession class

locust.clients.HttpSession

Response class

This class actually resides in the python-requests library, since that's what Locust is using to make HTTP requests, but it's included in the API docs for locust since it's so central when writing locust load tests. You can also look at the :pyResponse <requests.Response> class at the requests documentation.

requests.Response

ResponseContextManager class

locust.clients.ResponseContextManager

Exceptions

locust.exception.InterruptTaskSet

locust.exception.RescheduleTask

locust.exception.RescheduleTaskImmediately

Environment class

locust.env.Environment

Event hooks

Locust provides event hooks that can be used to extend Locust in various ways.

The following event hooks are available under :pyEnvironment.events <locust.env.Environment.events>, and there's also a reference to these events under locust.events that can be used at the module level of locust scripts (since the Environment instance hasn't been created when the locustfile is imported).

locust.event.Events

EventHook class

The event hooks are instances of the locust.events.EventHook class:

locust.event.EventHook

Note

It's highly recommended that you add a wildcard keyword argument in your event listeners to prevent your code from breaking if new arguments are added in a future version.

Runner classes

locust.runners.Runner

locust.runners.LocalRunner

locust.runners.MasterRunner

locust.runners.WorkerRunner

Web UI class

locust.web.WebUI

Other

locust.stats.RequestStats

locust.stats.StatsEntry

locust.debug.run_single_user