- Locust (swarm website with thousands of users) (pip3 install locust)
#locustfile.py
from locust import HttpUser, between, task
class WebsiteUser(HttpUser):
wait_time = between(5, 15)
def on_start(self):
self.client.post("/login", {
"username": "test_user",
"password": ""
})
@task
def index(self):
self.client.get("/")
self.client.get("/static/assets.js")
@task
def about(self):
self.client.get("/about/")
-
Run locustfile (visit http://127.0.0.1:8089)
locust
-
Run headless test
locust --headless --users 10 --spawn-rate 1 -H http://your-server.com