Created
April 9, 2015 14:26
-
-
Save jvanz/c937cd5b51962129670f to your computer and use it in GitHub Desktop.
locust test file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from locust import HttpLocust, TaskSet, task | |
import uuid | |
import resource | |
class UserBehavior(TaskSet): | |
uuid = uuid.uuid4() | |
cookies = None | |
@task(1) | |
def admin(self): | |
with self.client.get( '/admin', verify=False, catch_response=True ) as response: | |
if response.status_code == 200: | |
response.success() | |
else: | |
response.failure('Request failure') | |
if response.status_code == 400: | |
print str(response.status_code) + " - " + response.content | |
else: | |
print str(response.status_code) | |
class WebsiteUser(HttpLocust): | |
task_set = UserBehavior | |
min_wait = 5000 | |
max_wait = 9000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment