Set up Locust on Windows
In this post, I will be taking you through end to end steps to set up Locust on windows. Further to that, I will be running a sample script & access Locust WebUI to verify the environment
Locust is a python code based performance testing tool. It's quick to start & powerful at doing scalable distributed load testing. By default, it comes with support for HTTP protocol. Being a python tool, it's highly flexible. and its power can be taken to great extent to enable a user to test protocols other than HTTP which include but not limited to FTP, Websocket, IoT protocols etc. It can also be integrated with a real-time monitoring solution like InfluxDB + Grafana to get customized metrics.
You can download & install Python from here. As per locust documentation, locust is supported on version 3.8.So we will go ahead & download the latest version
See in Action: Setting up Python on Windows
As the above video says, make sure that you get correct python version on giving the command
Also with python, pip comes bundled up.PIP is a utility which can help to install python packages available at PyPI. locustio is also available on PyPI.
Hence in the next step, we will be installing locustio using PIP.
Now once we are done with the installation of Python, we need to install locust using pip utility.
To install locustio on windows using PIP, give the command:
On giving below command, the appropriate output should be shown:
Make sure script folder inside python is in system path as locustio package resides in this folder. Else, locust command would not be identified at a command prompt
You might face issue such as below while installing on Windows:
Complete solution description is available at the link
Install or upgrade the Setuptools Python package. It contains compatibility improvements and adds automatic use of compilers:
pip install --upgrade setuptools
Microsoft Visual C++ compiler
Install Microsoft Visual C++ 14.2 standalone compiler: Build Tools for Visual Studio 2019.
You don't need to install Visual Studio 2019.
Install Microsoft Build Tools for Visual Studio 2019.
In Build tools, install C++ build tools and ensure the latest versions of MSVCv142 - VS 2019 C++ x64/x86 build tools and Windows 10 SDK is checked.
The setup tools Python package version must be at least 34.4.0.
Copy below script in notepad & name it as locustfile.py. At this point don't bother about an understanding of the script
Open command prompt & go to the location of the script. Give a command to run a script
Once the script is run, locust UI can be accessed & performance test can be run from the same by defining a total number of users & linear ramp rate:
Create an integrated development environment for Locust using Pycharm
See in Action & More - Setup Pycharm on Windows & create your first Python Project
Don't limit yourself to beginner level ! Ask for 90 % off coupon code on complete course on Locust available on Udemy !