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

Specify LoadTestShape instead of having it declared in the locust file #1829

Closed
joaonc opened this issue Jul 29, 2021 · 7 comments
Closed

Specify LoadTestShape instead of having it declared in the locust file #1829

joaonc opened this issue Jul 29, 2021 · 7 comments
Labels
feature request stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it

Comments

@joaonc
Copy link

joaonc commented Jul 29, 2021

Is your feature request related to a problem? Please describe.

When using a custom load shape (class that extends LoadTestShape), then the class needs to be specified in the locust file.
Per documentation here:

If this type of class is found then it will be automatically used by Locust.

I see 3 issues with this:

  1. It's not very clear that the existence of the class in the locust file alters the test case load. A beginner would certainly miss this.
  2. If you want to change the load shape, you need to edit the locust file.
  3. You can only use that 1 shape class defined in the file.

Describe the solution you'd like

I'd love to be able to explicitly declare which load shape class to use in a User class, similar to how we specify the TaskSet classes.
If not specified, then use the default.

from my.shapes import Shape1, Shape2

class MyTest1(User):
    wait_time = constant(0.5)
    tasks = [UserTasks1]
    load_shape = Shape1

class MyTest2(User):
    wait_time = constant(0.5)
    tasks = [UserTasks2]
    load_shape = Shape2  # Different shape than in the other class!

Describe alternatives you've considered

I'm working on a custom LoadTestShape that reads from a file, so I can change the load by changing the external users data file instead of the locust file, but I think native support in Locust would be a lot better.

@joaonc
Copy link
Author

joaonc commented Jul 29, 2021

This may be related to #1734 (not sure).

@cyberw
Copy link
Collaborator

cyberw commented Jul 29, 2021

I definitely see the need for this, but it would be very complicated to implement (all the logic is based around having a total user count and weighted classes, not controlling ramp up per-user).

Maybe after 2.0 is released we can look into this. The new user distribution method (with master in control instead of individual workers picking what to launch) should at least make it a little easier to do this.

@mboutet
Copy link
Contributor

mboutet commented Jul 29, 2021

Also related to #1583

@joaonc
Copy link
Author

joaonc commented Jul 29, 2021

Is there a features list for later? Otherwise this will be closed due to inactivity, like #1583 was (this is pretty much a duplicate).

Would love to see this implemented!

@cyberw
Copy link
Collaborator

cyberw commented Jul 29, 2021

There's not really a feature list. If you really want a feature you might have to build it yourself :)

Imo, #1583 was more about decoupling shape selection from locustfile selection, this one is more about having independent shapes for different Users.

It seems (to me) more related to #575 (another abandoned ticket)

I'd love to see this feature, even without shapes it would be very useful to be able to say "I want X users of type 1 and Y user of type 2" instead of having to use weights. But someone needs to build it :)

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it label Sep 28, 2021
@github-actions
Copy link

github-actions bot commented Oct 8, 2021

This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!

@github-actions github-actions bot closed this as completed Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it
Projects
None yet
Development

No branches or pull requests

3 participants