Created
January 9, 2019 20:58
-
-
Save lukaszczerpak/9de66a39e0b298036fa2dfebce67b364 to your computer and use it in GitHub Desktop.
Sample virtual user behavior for locust.io
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 | |
from locust import Locust, task, events, web | |
class UserBehavior(TaskSet): | |
@task(10) | |
def homepage(self): | |
self.client.get("/") | |
@task(5) | |
def product1(self): | |
self.client.get("/helena-hooded-fleece.html") | |
@task(5) | |
def product2(self): | |
self.client.get("/logan-heattec-reg-tee.html") | |
@task(3) | |
def page_women(self): | |
self.client.get("/women.html") | |
@task(3) | |
def page_men(self): | |
self.client.get("/men.html") | |
@task(4) | |
def cleanup(self): | |
self.client.get("/about-us") | |
self.locust.client.cookies.clear() | |
class WebsiteUser(HttpLocust): | |
task_set = UserBehavior | |
min_wait=4000 | |
max_wait=8000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment