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

calling taskset and tasks on if else conditions #504

Closed
PrithiviRajG opened this issue Nov 24, 2016 · 3 comments
Closed

calling taskset and tasks on if else conditions #504

PrithiviRajG opened this issue Nov 24, 2016 · 3 comments

Comments

@PrithiviRajG
Copy link

I am using Locust for doing performance test for Test taking App.

There are so many conditions in the app, on each condition I would follow the separate flow.

taking test is a single task but it will have so many conditions and http requests,
whether I have break this into different task?
if Yes how can I do it?

can I call multiple http request on single task?
if yes, how to set the minimum wait time and maximum wait for requests inside the task.

@heyman
Copy link
Member

heyman commented Nov 24, 2016

I don't understand your first question.

can I call multiple http request on single task?
if yes, how to set the minimum wait time and maximum wait for requests inside the task.

You can make multiple HTTP requests within a single task.

I think you've misunderstood what TaskSets' min_wait and max_wait is. If you want the simulated user to wait between two requests within the same task, just use time.sleep().

@PrithiviRajG
Copy link
Author

@heyman Thanks for the quick reply. I will try to explain my scenario clearly below.
The following is the sample flow of Application

  • Registration or Login (taskset with 2 tasks)
  • Take Test (taskset with 1 task)
    • load Question
      • Attend Question
        • if correct, go to next question
        • if wrong, load the same question

in the above sample, Take test is a single task with multiple flows and it almost covers the entire business flow.

I cannot split this into different tasks as they are sequence of flows and user cannot bypass the flow.
A real user will take some time between going to the next sequence, so I wanted to use min_wait and max_wait but we cannot use for request level and it's task level.

can I use time.sleep() between each request or is it possible to split the sequence into different tasks and it will execute in a sequence?

I am new to performance testing and locust, pardon me if I miss something.

@heyman
Copy link
Member

heyman commented Nov 24, 2016

Sleeping between each request is fine (you could also call self.wait() which would sleep for a random number of milliseconds between the defined min_wait and max_wait). You could probably split it between tasks as well, together with storing some state on the Locust instance.

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

3 participants