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

Testing "Any" system #75

Closed
ghost opened this issue May 20, 2013 · 1 comment
Closed

Testing "Any" system #75

ghost opened this issue May 20, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented May 20, 2013

The docs says that I can test any system. I've written a simple test file for a code generating script, but when I run locust, even though I see it's spawning the processes as specified I get absolutely no stats. Can you give me a simple example of how to test something that's not a web app using locust?
Thanks!

@heyman
Copy link
Member

heyman commented May 20, 2013

Hi!

Currently, you need to fire the internal request_success event (http://docs.locust.io/en/latest/api.html#locust.events.request_success) or request_failure event manually in your client when testing some other system.

Here's a small fictive example:

from time import time
from locust.events.import request_success

class MyCustomClient(SomeProtocol):
    def do_request(self, endpoint_name, request_type, *args, **kwargs):
        start_time = time()
        data = super(MyCustomClient, self).do_request(endpoint_name, request_type, *args, **kwargs)
        response_time = time() - start_time
        request_success.fire(method=request_type, path=endpoint_name, response_time=response_time, content_length=len(data))
        return data

I haven't tested the above code, but you should get the idea. There are plans for making so that you can plug in a custom client part of the official API soon, and then it will get proper documentation.

@Jahaja Jahaja closed this as completed Nov 29, 2013
pancaprima added a commit to pancaprima/locust that referenced this issue Aug 21, 2018
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

2 participants