Load Testing with Locust#
Load test web applications with Locust: users and tasks, wait times, events, HTTP requests, response validation, step load and distributed mode.
How each session works#
The big idea: the topic in plain words, with an everyday example.
A picture: a diagram of the idea.
Real runs: every test was run with Locust 2.28 against a small practice shop on your own computer, and the output you see is what it printed.
Common mistakes: what trips beginners up.
Hands-on exercises: try first, then open the solution.
Practice: a quiz for the session.
Important
Only load test systems you own or have written permission to test. The practice shop in code/shop_server.py is
yours to hammer. Numbers such as requests per second differ on every computer and every run; look at the shape of the results.
Sessions
- Session 1 · Why load testing, and installing Locust
- Session 2 · Users, tasks and wait times
- Session 3 · Different users and ordered tasks
- Session 4 · Setup and clean-up: on_start, on_stop and test events
- Session 5 · Testing a web service with HttpUser
- Session 6 · Checking responses with catch_response
- Session 7 · Shaping the load: step tests and logging
- Session 8 · Running Locust in distributed mode
Original notes (reference)
- Why Load Testing ?
- Locust Installation
- Understanding Locust Wait Times with Complete Examples
- Simulating Multiple User Types in Locust
- Why on_start and on_stop are Essential for Locust Users
- How to use test_start and test_stop Events in Locust
- @task decorator
- task attribute
- Sequential Task Set
- HTTP Load Testing with Locust's HttpUser
- Load Testing with HTTP POST Requests in Locust
- Using catch_response in Locust for Custom Response Validation
- Iterative Load Testing with Step Size in Locust
- Enhancing Your Locust Tests with Custom Logging
- Running Locust in Distributed Mode with Master and Workers