Skip to content

Instantly share code, notes, and snippets.

@EastResident
Created October 17, 2018 07:40
Show Gist options
  • Save EastResident/354e8cd84d5a3a2c5af91227e7c3ede9 to your computer and use it in GitHub Desktop.
Save EastResident/354e8cd84d5a3a2c5af91227e7c3ede9 to your computer and use it in GitHub Desktop.
inside-locust-03
from locust import HttpLocust, TaskSet
def login(l):
l.client.post("/login", {"username":"ellen_key", "password":"education"})
def logout(l):
l.client.post("/logout", {"username":"ellen_key", "password":"education"})
def index(l):
l.client.get("/")
class UserBehavior(TaskSet):
tasks = {index: 2, profile: 1}
def on_start(self):
login(self)
def on_stop(self):
logout(self)
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