Trying to run my Locust file and while doing so I'm facing the following error while trying command locust -f locustfile.py --host=http://localhost:8080
File "/home/sonali/.local/lib/python3.6/site-packages/locust/user/task.py", line 280, in run self.schedule_task(self.get_next_task()) File "/home/sonali/.local/lib/python3.6/site-packages/locust/user/task.py", line 408, in get_next_task return random.choice(self.user.tasks) File "/usr/lib/python3.6/random.py", line 260, in choice raise IndexError('Cannot choose from an empty sequence') from None Cannot choose from an empty sequence
My locust file is as follows:
from locust import HttpUser, task, between ,TaskSet
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before
any task is scheduled
"""
self.login()
def login(self):
self.client.post("/login",
{"username":"ellen_key",
"password":"education"})
@task(2)
def index(self):
self.client.get("/")
@task(1)
def profile(self):
self.client.get("/profile")
class WebsiteUser(HttpUser):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000