How to Run Locust

Once you have the library installed, you can simply follow the output from running locust -h to run your test. Note that if you don’t specify a locustfile with -f FILE_NAME, locust will look for a file called locustfile in the current directory by default.

Web Flow

If you supply no arguments to locust other than the locustfile, Locust will launch in a web mode. This is not recommended, mainly because you can’t automate running it as it requires manual interaction as well as access to the flask application.

locust -f example_locustfile.py

If you navigate to http://localhost:8089/ you’ll see the following:

Locust web view

These arguments map to the same arguments described in the Required Arguments section.

Once you hit “start swarming”, you’ll see graphs reporting latencies, errors, and other data. These can be useful for visually understanding how a load test is performing.