Created
March 28, 2018 12:36
-
-
Save wilxsv/9cbd5de8ca03325d27f472796fd28022 to your computer and use it in GitHub Desktop.
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("/") | |
def profile(l): | |
l.client.get("/profile") | |
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