Reputation: 7457
Is there some method (ideally for a User
class) or event or other way in Locust to execute some setup code before each task?
What I have looked into:
on_task_start
test_start
, but unfortunately none like task_start
wait_time()
method on a User
class, but that is an ugly work around, and the method is not called before the first task of each User
instance.Upvotes: 1
Views: 1800
Reputation: 197
You can add custom events to locust see: https://docs.locust.io/en/stable/api.html#EventHook%20class
update:
class DbTaskSet(TaskSet):
def __init__(self, parent):
super().__init__(parent)
def execute_next_task(self):
myevent.fire()
super().execute_next_task()
Upvotes: 1