Skip to content

Instantly share code, notes, and snippets.

@akuikialie
Created September 20, 2023 01:09
Show Gist options
  • Save akuikialie/40a62f0cfad8288f3c3677baa7a0a709 to your computer and use it in GitHub Desktop.
Save akuikialie/40a62f0cfad8288f3c3677baa7a0a709 to your computer and use it in GitHub Desktop.
Locust Load Test - Default Route API
import time
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(1, 10)
#@task
#def default_login(self):
# self.client.get("/login")
@task
def default_route(self):
self.client.get("/api")
@task
def default_dashboard_mitra(self):
self.client.get("/api/dashboard/mitra")
@task
def default_dashboard_mitra_search(self):
self.client.get("/api/dashboard/mitra?name=antopo&limit=2")
# @task(3)
# def view_items(self):
# for item_id in range(10):
# self.client.get(f"/item?id={item_id}", name="/item")
# time.sleep(1)
#
# def on_start(self):
# self.client.post("/login", json={"username":"foo", "password":"bar"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment