-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to setup/teardown before running the load tests #553
Comments
you want to use |
I am looking for some way to invoke a setup() code before starting any virtual user. Right now, the only for me to do it, is to wrap locustio code with my own python wrapper, that does the setup/teardown, etc and then invoke locustio.main() I don't think on_start() works that way does it ? |
not really... it runs per user, so wouldn't really be useful for a global setup step. |
You should be able to add the code to the locustfile before you define the locust or anything else for your startup event. Just make sure your code is setup to execute on import. |
I need to do a singular setup to prime a database with information prior to the TaskSet execution. I need to access self.client to post resources... How would I access that variable prior to locust setup? |
Bumping this. I am in the same situation as @MushuEE I need to create resources before the load tests start and remove them after all load tests finish. |
Right, but the setup/teardown functions under a locust are executed before/after an individual locust is hatched, correct? I was looking for a way to setup shared resources among all locusts and teardown those shared resources at the very end. |
@payton you can define the
I have not touched this for a little while now so I hope that helps
and similarly
|
@MushuEE where does the |
It worked this way for me. Reading a file before starting: class User(HttpUser):
|
You can try to use the @event.init.add_listener
|
This is usually stuff that needs to happen only once across before starting any clients/tasks
and once after all load test is complete.
I can use the quit event for the tear down i think.
Is there a start event that I can plugin into for setup ?
The text was updated successfully, but these errors were encountered: