Locust
Distributed load testing framework in Python.
Quick Start
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 3)
@task(5)
def browse(self): self.client.get("/products")
@task(1)
def checkout(self): self.client.post("/checkout", json={"item": "book"})
locust -f locustfile.py --web-host localhost
When to Use
- API load testing; Performance regression; Capacity planning; Spike testing
Validation
- Locust UI shows metrics; 2. RPS displays correctly; 3. Test stops and reports