reworked structure and improved performance to handle 500 concurrent users
This commit is contained in:
27
test/locustfile.py
Normal file
27
test/locustfile.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from locust import HttpUser, task, between
|
||||
import random
|
||||
|
||||
class StudentUser(HttpUser):
|
||||
wait_time = between(1, 10)
|
||||
|
||||
def on_start(self):
|
||||
# Register a user and get a cookie
|
||||
username = f"testuser_{random.randint(1, 100000)}"
|
||||
self.client.post("/register", data={
|
||||
"username": username,
|
||||
"acknowledge": "on"
|
||||
})
|
||||
self.client.post("/access", data={"password": "locust"})
|
||||
|
||||
@task(5)
|
||||
def view_index(self):
|
||||
self.client.get("/")
|
||||
|
||||
@task(1)
|
||||
def enter_password(self):
|
||||
self.client.post("/access", data={"password": "locust_test"})
|
||||
|
||||
@task(3)
|
||||
def view_slide(self):
|
||||
# Simulate loading slide files
|
||||
self.client.get("/slides/itsec2526/tut-01/index.html")
|
||||
Reference in New Issue
Block a user