Skip to content

Instantly share code, notes, and snippets.

@sedkis
Created July 27, 2022 15:51
Show Gist options
  • Save sedkis/2d6061743fb6349c0cc21fcb68ebf6b6 to your computer and use it in GitHub Desktop.
Save sedkis/2d6061743fb6349c0cc21fcb68ebf6b6 to your computer and use it in GitHub Desktop.
locustfile.py
from locust import HttpLocust, TaskSet, task
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(TaskSet):
# one can specify tasks like this
tasks = [index, stats]
# but it might be convenient to use the @task decorator
@task
def page404(self):
self.client.get("/hello")
class WebsiteUser(HttpLocust):
"""
Locust user class that does requests to the locust web server running on localhost
"""
host = "https://so-called-impudence-gw.aws-use1.cloud-ara.tyk.io/v1.0/CVD-Cloud-2/vin/JTEBU5JR8L5813911"
min_wait = 2000
max_wait = 5000
task_set = UserTasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment