realbrowserlocusts icon indicating copy to clipboard operation
realbrowserlocusts copied to clipboard

Maybe integrate this into locust-plugins?

Open cyberw opened this issue 4 years ago • 11 comments

Hi @nickboucart !

I'm one of the maintainers of Locust and the creator of "locust-plugins", a collection of addons for locust.

Before I found your code, I made my own "WebdriverLocust" as part of "my" package (see https://github.com/SvenskaSpel/locust-plugins/blob/66c880057576634711fb3a5ed26c72dde086d942/locust_plugins/users.py#L98 / https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/webdriver.py).

I think yours looks a lot better, with its built in support for multiple browsers and proper timing measurements.

Would you consider contributing it to "my" repo? (released under the apache license). You would of course be credited, and if you want I can add you as maintainer for the repo.

cyberw avatar May 30 '20 12:05 cyberw

Hi Lars,

Thanks for reaching out.

I’m happy you did, because I’m not using nor maintaining this project anymore. I once needed to do some performance testing of a webapp in really ancient technology, that generated urls on the fly, only way to test that was through a browser... I stumbled upon Locust and immediately loved the syntax and philosophy.

I made this little library, put in on GitHub and actually forgot about it. Every now and than, I get screwiness or a question, each time I feel sorry to not spending more time on it.

If you would like to take over the library as a whole, or part of the code and integrate it in bigger ecosystem of plugins, feel free to do so. In fact, I’d be happy to see that someone who’s more committed to locust would adopt/leverage the code, it will most likely be more helpful than it is now.

What do you think? how can I help you with the transfer?

Hope this helps, Nick

On Sat, 30 May 2020 at 14:34, Lars Holmberg [email protected] wrote:

Hi @nickboucart https://github.com/nickboucart !

I'm one of the maintainers of Locust and the creator of "locust-plugins", a collection of addons for locust.

Before I found your code, I made my own "WebdriverLocust" as part of "my" package (see https://github.com/SvenskaSpel/locust-plugins/blob/66c880057576634711fb3a5ed26c72dde086d942/locust_plugins/users.py#L98 / https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/webdriver.py ).

I think yours looks a lot better, with its built in support for multiple browsers and proper timing measurements.

Would you consider contributing it to "my" repo? (released under the apache license). You would of course be credited, and if you want I can add you as maintainer for the repo.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nickboucart/realbrowserlocusts/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVFPKJHA3C6D6726RCLHDRUD4O3ANCNFSM4NOVW4RQ .

nickboucart avatar May 31 '20 14:05 nickboucart

Cool! I think this is how a lot of open source projects get started today - it is really nice how easy it is to share your stuff with the world today :)

Could you make a PR to the locust-plugins repo? Put your example into the examples directory and the rest (Locust class) in a single file (maybe realbrowser.py, or webdriver.py).

If you have the time to update it for Locust 1.0 that would be even better! Some things have changed, like ”Locust” classes are now ”User” classes, and your User class should have a property called ”abstract” set to True (otherwise Locust may try to run it as well, even though it doesnt have tasks defined). If you dont have the time, or if you run into trouble, I can help with this.

Feel free to add your name to a comment in the header. ”Contributed by ...” or something.

When it is done, you could replace the contents of your current repo with a readme that points people to locust-plugins instead.

cyberw avatar May 31 '20 17:05 cyberw

Hi Lars,

Sounds good to me. I'll try to find some time on an evening during this week. I really like this solution and would feel happy with this outcome.

i can't really promise an exact timing (and please, do not hesitate to send me a ping every now and than) , I'll do my best :)

Keep you posted. Nick

On Sun, May 31, 2020 at 7:44 PM Lars Holmberg [email protected] wrote:

Cool!

Could you make a PR to the locust-plugins repo? Put your example into the examples directory and the rest (Locust class) in a single file (maybe realbrowser.py, or replace my webdriver.py).

If you have the time to update it for Locust 1.0 that would be even better! Some things have changed, like Locust classes are now User classes, and your User class should have a property called ”abstract” set to true (otherwise Locust may try to run it as well, even though it doesnt have tasks defined). If you dont have the time, I can help with this.

Feel free to add your name to a comment in the header. ”Contributed by ...” or something.

When it is done, you could replace the contents of your current repo with a readme that points people to locust-plugins instead.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nickboucart/realbrowserlocusts/issues/12#issuecomment-636503944, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVFPN65AEP6NUGDXZV23LRUKJPJANCNFSM4NOVW4RQ .

nickboucart avatar Jun 02 '20 10:06 nickboucart

Cool! Thanks! :)

cyberw avatar Jun 02 '20 10:06 cyberw

*ping* @nickboucart ;)

cyberw avatar Jul 13 '20 21:07 cyberw

@cyberw I have tried cloning this repository with Locust to User change. I am getting the below exception. Have you come across anything like this when spawning?

locust.runners: Unhandled exception in greenlet: <Greenlet at 0x107a3d488: > Traceback (most recent call last): File "src/gevent/greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run File "/Users/loges/.pyenv/versions/3.7.2/lib/python3.7/site-packages/locust/runners.py", line 334, in self.hatching_greenlet = self.greenlet.spawn(lambda: super(LocalRunner, self).start(user_count, hatch_rate, wait=wait)) File "/Users/loges/.pyenv/versions/3.7.2/lib/python3.7/site-packages/locust/runners.py", line 252, in start self.spawn_users(user_count, hatch_rate=hatch_rate, wait=wait) File "/Users/loges/.pyenv/versions/3.7.2/lib/python3.7/site-packages/locust/runners.py", line 172, in spawn_users hatch() File "/Users/loges/.pyenv/versions/3.7.2/lib/python3.7/site-packages/locust/runners.py", line 165, in hatch new_user = user_class(self.environment) TypeError: init() takes 1 positional argument but 2 were given

logesr avatar Jul 14 '20 08:07 logesr

Hi! I think it is related to this code:

    def __init__(self):
        super(RealBrowserLocust, self).__init__()

It should be more along these lines (copied from users.py in locust-plugins)

class SocketIOUser(HttpUser):
    abstract = True

    def __init__(self, parent):
        super().__init__(parent)

(the exception is because of the parent parameter being missing, but you should also add the abstract property, or you will run into a different problem)

cyberw avatar Jul 14 '20 12:07 cyberw

@cyberw Thanks for this. It has worked out.

logesr avatar Jul 15 '20 09:07 logesr

@cyberw @nickboucart Any updates on the plugin or future news of maintaining this repo?

npandey3 avatar Jul 21 '20 15:07 npandey3

No news, still waiting for the PR from Nick.

Just to be clear, the PR doesnt need to be perfect, but for copyright reasons I think it makes sense that he makes it.

cyberw avatar Jul 23 '20 13:07 cyberw

@nickboucart Any chance you'll have time to look at this?

cyberw avatar Oct 16 '20 06:10 cyberw