A normal test file is written in python.
As locust is best used with http(s) requests you can easily define login behaviour. It will keep this across each user it spawns. (It also follows redirects (usefull to know when considering load testing something that points to a resource outside a VPC as it could overload the NAT server).
The test below logs a user in to groupster then requests what will be their home page 1 time for every 3 times it requests a group page.
Max wait and min wait are the amount of time each user will wait before executing each task (in milliseconds)
Below is an example:
from locust import HttpLocust, TaskSet
def login(l):
l.client.post("/login/process", {"email":"[email protected]", "pass":"password"})
def index(l):
l.client.get("/")
def group(l):
l.client.get("/group/1/")
class UserBehavior(TaskSet):
tasks = {index:1, group:3}
def on_start(self):
login(self)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=5000
max_wait=9000
Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!