Skip to content

Instantly share code, notes, and snippets.

@jvanz
Created April 9, 2015 14:26
Show Gist options
  • Save jvanz/c937cd5b51962129670f to your computer and use it in GitHub Desktop.
Save jvanz/c937cd5b51962129670f to your computer and use it in GitHub Desktop.
locust test file
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