
Learn Locust, an easy to use event-based framework for performance testing in Python that lets you create scalable, distributed load tests with user scenarios and out-of-the-box analytics.
Set up the complete Locust and Python development environment, install Python 3 and pip, install Locust, choose an existing interpreter, and create a sample project to run basic tasks.
Learn how to define user and task set with sequential task set in Locust, compare random versus sequential execution, apply weight attributes for tasks, and coordinate multiple task classes.
Learn how Locust uses local state controls and event hooks, including on_test_start, on_test_stop, on_start, and on_stop, to manage when tests and users begin and end.
practice the concepts of locust with attached locust files
Define asset classes and connect them to user classes to model multiple user types—registered, guest, and mobile—driving workflows like navigate categories and add to cart to simulate real-world e-commerce load.
Learn how to load Locust test users from a csv file into memory once, then fetch them for login simulations via a static loader and a get method.
Learn how to implement user login and session management in Locust with a post login flow, cookie handling, and using cookies to authorize subsequent requests.
Model multiple user types and their load distribution in Locust and Python by simulating registered and guest users, cookies, and category navigation to test a modern performance framework.
Compare cookies for registered and guest users by printing header cookies, then store and retrieve them with the framework, illustrating the abstract class handling cookies.
Learn to implement Locust event hooks to capture and store detailed request data for every call, including response time, status, and exceptions. Export the data to files for analysis.
Install the Python InfluxDB client, run a Docker InfluxDB container, create and switch to a new database, and store event data using a template with measurements, tags, and timestamps.
Integrate Grafana with InfluxDB to visualize performance data from Locust, set up a data source, and build dashboards showing response time, response length, and failures.
Project source code attached as .zip
Run Locust tests using configuration files to configure single-node master and multi-node slave setups. Set users, spawn rate, and runtime, and view aggregate reports and failures.
Explore the init event in master-slave Locust setups, learn task tagging, build a custom client with success and failure events, and run Locust as a library with csv stats.
In this lecture, learn how to distribute unique users across master–worker nodes using a Python RPC server, with a user distributor that locks access to prevent duplicates.
Section-1 : you will learn the basic concept of locust and standard features.
a. Setup development environment
b. Explanation of User, TaskSet and Sequential TaskSet
c. Explanation on_test_start, on_test_stop, on_start, on_stop
d. REST execution using locust HTTPUser class
Section-2 : you will learn how to use locust to create a concrete performance test framework to perform load and stress testing on your application under test, you will also learn how to integrate with InfluxDB and Grafana for better performance data analysis.
a. Abstract HTTPUser class and usage
b. TaskSet Modules and User Integration
c. Loading Users from CSV
d. User Login & Session Management
e. Multiple User Types & Distribution
f. Registered & Guest User Cookie
g. Custom Logger & Step Load
h. Event Hooks & Request Data Store
i. Request Data Store in InfluxDB
j. Grafana & InfluxDB integration
Section-3 : you will learn different execution model of locust which include master-slave configuration as well. In section4 you will get to know few extra topics of locust which might be useful for your specific project.
a. Locust Master-Slave architecture model
b. Locust execution with config file
Section-4 : Extra topics which will help to design your own framework and clear report analysis concepts.
a. INIT Event, Tagging Tasks, Custom Client, Stats in CSV, Locust as library
b. Unique Users Distribution For Master-Worker Execution Model
c. Significance of Mean & Standard Deviation Calculation