A sample implementation of Locust performance testing in Python.
The tests were written for https://github.com/andreasneuber/automatic-test-sample-site-py The README in that repo has further details on how to set it up.
Clone the repo and set up the virtual environment and dependencies as follows:
# Clone the repository
git clone <repo-url>
cd locust-python-example
# Create virtual environment
python -m venv .venv
# Activate virtual environment (Windows PowerShell)
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Verify Locust installation
locust -VAfter activation, you should see a (.venv) prefix in your terminal prompt.
Tests are located in locustfile.py
Make sure you are in the root folder of the project, execute in terminal: locust then open http://localhost:8089/ in a browser,
and add http://localhost:5000 as the host URL.
locust -f locustfile.py --headless --host http://localhost:5000 --users 100 --spawn-rate 5
As a matter of principle - whatever can be run in a terminal can be run in a pipeline ;-)