Created
September 20, 2023 01:09
-
-
Save akuikialie/40a62f0cfad8288f3c3677baa7a0a709 to your computer and use it in GitHub Desktop.
Locust Load Test - Default Route API
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
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