I am just getting started with Locust. Here is my locustfile.py
from locust import HttpLocust, TaskSet, between, TaskSequence
def select_user(l):
pass
def get_company(l, company):
target = "https://URL"
print(f"Company: {company} URL: {target}")
response = l.client.get(target, {"name": company })
return response
class UserBehavior(TaskSequence):
def on_start(self):
response = get_company(self, "LoadTest")
print(response)
# @seq_task(1)
# def first_task(self):
# pass
class User(HttpLocust):
tasks = [UserBehavior]
wait_time = between(5, 60)
when I run locust in the same directory as locustfile.py I get the error:
% locust
[2020-05-15 20:43:08,131] host/ERROR/locust.main: No Locust class found!
It is unclear to me what I have wrong. I am using TaskSequence because once I get this working, I will be adding tasks which must be executed in a specific order.
Additionally, if I uncomment the @seq_task(1) decorator I get an error that seq_task
is not defined.
This is on
% locust --version
locust 0.14.4