Skip to content
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

Working with long running user flows #386

Closed
jurisbu opened this issue Feb 24, 2016 · 5 comments
Closed

Working with long running user flows #386

jurisbu opened this issue Feb 24, 2016 · 5 comments

Comments

@jurisbu
Copy link

jurisbu commented Feb 24, 2016

My use case is mostly with long running user flows (see hypothetical example to get the idea). The whole flow might take 15-20 minutes to execute.

class BatchJobTask(TaskSet):
    def upload_batch_data(self):
        pass

    def create_batch_job(self):
        pass

    def delete_batch_job(self):
        pass

    def start_batch_job(self):
        pass

    def download_batch_job_result(self):
        pass

    def wait_for_batch_job_to_finish(self):
        pass

    @task
    def user_flow(self):
        self.upload_batch_data()
        self.create_batch_job()
        self.start_batch_job()
        self.wait_for_batch_job_to_finish()
        self.download_batch_job_result()
        self.delete_batch_job()


class BatchJobUser(HttpLocust):
    task_set = BatchJobTask

The problems that I currently see are:

  1. When stopping test some users will be in the middle of flow execution. Which means that essentially system under test will be left in dirty state. I would need a mechanism to gracefully stop test so that user flows execute till the end.
  2. I would prefer to have a control of how many user flows will be executed in total. Say I want 20 concurrent users emulated, but in total I want 100 user flows executed. Currently it seems there is no way to specify this. Either users will be hatching infinitely (until test is stopped), or I can specify total requests to be performed (which will not make sense in multi-request user flow scenario).

Any ideas?

@justiniso
Copy link
Member

Can I take a step back and ask why locust is the tool you chose in this case? The primary advantages of locust relate to high throughput systems with high concurrency. In general, this type of testing is used for stateless systems. If your target numbers are 20 concurrent users for a total of 100 user flows, that can be easily scripted with a single python script using threading. It also allows for cleanup as you describe (in something like a try-finally) block.

@jurisbu
Copy link
Author

jurisbu commented Feb 13, 2017

Thanks @justiniso for taking time to reply. Just FYI did an assessment on locust and it was deemed not fit for use case at hand. For the reasons you highlighted above. Had to choose a different toolstack.
Although it might be true regarding a scripted approach with python and threading it will not provided unified reporting and in general added value of a proper test tool. It is pity that locust was not suited for this task though.

@pawamoy
Copy link

pawamoy commented Nov 16, 2020

Check out the --stop-timeout option.

@cyberw
Copy link
Collaborator

cyberw commented Nov 16, 2020

This ticket is way old :)

But yes, --stop-timeout, combined with -i from https://github.com/SvenskaSpel/locust-plugins#command-line-options should solve this particular case very well

@pawamoy
Copy link

pawamoy commented Nov 16, 2020

Yes it was more for future reference and other users than to answer to the original author 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants