Skip to content

Commit 475e79d

Browse files
committed
Example locustfile
0 parents  commit 475e79d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

locustfile.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from locust.clients import HttpSession
2+
3+
4+
def test_task(session: HttpSession):
5+
session.base_url = "https://mock-test-target.eu-north-1.locust.cloud"
6+
7+
session.post("/authenticate", json={"username": "foo", "password": "bar"})
8+
9+
for product_id in [1, 2, 42, 4711]:
10+
session.post("/cart/add", json={"productId": product_id})
11+
12+
with session.post("/checkout/confirm", catch_response=True) as resp:
13+
if not resp.json().get("orderId"):
14+
resp.failure("orderId missing")
15+
resp.raise_for_status()

0 commit comments

Comments
 (0)