-
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
Feature request: on_quit() #248
Comments
+1 I don't get why |
Well, that would be a great feature, something like a cleanup for automated tests. In my case there are a lot of test users registering and creating some content, it would be nice to have a way to automatically remove all of this when the test are done (though, in real life I would rather do it myself, so I can inspect the data in case if something goes wrong during the tests) |
+1, the equivalent of I'm using this simple workaround at the moment. Since class MyTaskSet(TaskSet):
def on_start(self):
locust.events.quitting += self.on_quit
def on_quit(self):
... |
+1 |
+1 this is a must have if engs need to continue working with this framework. |
Also would opt in for this one. Solution suggested by @ze-phyr-us works good if you have plain structure (With only one task_set), but doesn't really work with nested tasksets as they won't execute their teardown up until whole locust process quits. So that's definitely a must have here. |
How is |
this is an old request that has already been implemented: https://docs.locust.io/en/stable/writing-a-locustfile.html#setups-teardowns-on-start-and-on-stop |
There is a way to define a method that executes when a task set starts; ie, on_start(). It would be useful to have a similar method, on_quit() when the task set is terminated.
I want my task set to share a common identifier. I create this in on_start(). A side effect of the tests is to create an artifact with this identifier in the name. When the tests terminate, I want the artifact to be deleted.
I've tried using the events.on_quitting event for this. However, as far as I can tell, this is called in the context of the Locust object, not in the context of the task itself.
The text was updated successfully, but these errors were encountered: