Created
October 17, 2018 07:40
-
-
Save EastResident/354e8cd84d5a3a2c5af91227e7c3ede9 to your computer and use it in GitHub Desktop.
inside-locust-03
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 | |
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