Locust Directory

Our community contributed locustfile examples directory.

Introduction

Community locustfiles

LoadForge uses the locust.io load testing application to generate load from it's clusters. We support custom locustfiles for advanced load testing, and, have a community driven directory of examples for you to use.

Please consider contributing to the Git repo that drives this directory.

To use these you can copy the code section into your "locustfile" setting when creating or editing a Test.

For more help on Tests please see our official documentation. Logged in users can also use our wizard to generate a locustfile, or you can record your browser steps.

Browse

Name Description
Adding Sleeps How to add custom sleep times to a test
Basic API Load Test Example Load test a REST based HTTP API with Bearer token authentication
Checking Response Text And Time Check for a specific word in the result, and that it doesn't take over 0.5 seconds.
Checking Status Codes Test that checks for a 404 response or considers it a failure.
Crawling Real HTTP User Index a site and crawl all the pages with a random delay as a real user would.
Custom HTTP Headers How to set custom headers with your requests
Disable SSL Verification Examples of how to prevent SSL verification on your tests.
Getting Auth Token Send a login request to get an authorization token for the rest of your test
GraphQL Load Test Example Load test a GraphQL based API (SpaceX in this example)
Index Get With Content Index page GET with several static content items included.
Laravel REST API Example Load testing a REST based Laravel (or other) API example with auth and CRUD.
Login And Crawl All Pages Login to a site and crawl all the pages on the index page.
Login And Get Profile Test that logs in and then requests a profile page.
Login At Start Test that logs in for each simulated user before testing.
Login With Basic Auth Login to your site or API using basic authentication
Login With CSRF Token Support CSRF tokens, for example with the Laravel framework.
Multiple User Logins How to create a test that logs in as different users
Post With JSON Data Send an HTTP POST request with a JSON data payload
Setting A Random User-Agent Create a list of user agents and select one at random for each client
Simple Index Get Index page with a simple HTTP GET and a simulated user wait time between pages.
Testing Webserver Vs Web App Generating load on the webserver as opposed to the web application
Testing Websockets How to use LoadForge to load test websockets based applications
WordPress Load Test Example Load test a WordPress based Blog or CMS with automatic crawling