OS: Windows 7
Locust version: 0.11.0
I am exploring the locust tool to see if i can use this tool in my project.
I have created the below file to have hands-on but apparently script is not running.
I am not sure on the reason though.
Can someone help me please?
Locust.py:
from locust import HttpLocust, TaskSet
def login(l):
l.client.post("/login", {"username":"ellen_key", "password":"education"})
def logout(l):
l.client.post("/logout", {"username":"ellen_key", "password":"education"})
def index(l):
l.client.get("/")
def profile(l):
l.client.get("/profile")
class UserBehavior(TaskSet):
tasks = {index: 2, profile: 1}
def on_start(self):
login(self)
def on_stop(self):
logout(self)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000
Output:
Tool kept running as below.

With default arguments, you need to access the web monitor at localhost:8089 in order to see the application.
If you want to run without the web frontend, you need to specify the arguments (clients, runtime, hatchrate, etc) in such a way to replicate what the webclient parameters are.
In Windows, by default the Web-host is listening on IPv6, so while accessing the site using http://0.0.0.0:8089 might yield Error :This site can’t be reached 127.0.0.1 refused to connect.
Run the locustby specifying the web-host as the argument. Then the web will be accessible.
locust --web-host 0.0.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With