This section provides an overview of the locust_demo
under the /performance-testing/
path. Locust is an open-source load testing tool that makes it easy to hit your app with many simulated users.
What is Locust?
- Locust is a distributed, user-centric load testing tool. It allows you to simulate thousands of users hitting your system in a way that is similar to real users.
Why use Locust?
- Simulate real user behavior.
- Run tests on-premise or in the cloud.
- Write tests in Python, which makes it easy to integrate with your existing codebase.
How to run a Locust test?
- Install Locust:
pip install locust
- Create a
locustfile.py
with your test scenarios. - Run the test with
locust --host=http://localhost:8089/
- Install Locust:
Example Test Scenario
- This is a simple test scenario to simulate users logging in to a website.
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 5)
@task
def login(self):
self.client.post("/login", data={"username": "user", "password": "pass"})
- Further Reading
- For more detailed information, check out the Locust documentation.
Locust Dashboard