Adding or Editing Load Tests
If you want to add or edit a load test, here are the general steps (more detailed information can be found in the rest of the documentation):
- Start by finding (or creating) the corresponding
User
class (e.g.PrimeUser
).- See Locustfile for more info on working with
locustfiles
andUsers
.
- See Locustfile for more info on working with
- Find (or create) the
TaskSet
that defines the tasks (load tests) the user will perform.- We have
TaskSets
for all of our users, so you may be able to add your new load test to an existing class, but one thing to keep in mind is that someTaskSets
are shared across users. - If the
TaskSet
is used by multipleUser
classes, see if it makes sense for your load test to be run by all the users that use the existingTaskSet
or if you should create a newTaskSet
and add it to the user'stasks
attribute. - See TaskSet for more info on working with
TaskSets
.
- We have
- Add a task (a function/method decorated with the
@task
decorator) to theTaskSet
.- You should also decorate it with any tags you think are relevant to this task.
- Run the load test and check that your task is working properly.
- If it is, you're good to go!
- See Running Load Tests for more info on how to run load tests.