Example tests and snippets

Including Static Content

It's quite common with LoadForge tests to ignore static content (images, stylesheets, javascript, etc) as the main source of load will be your dynamic pages. However, it can be good to test the capacity of your webserver as well.

Tried the Wizard?

You can use the Wizard with static content enabled and it will automatically generate a test for you with your images, stylesheets and javascript files included. You can also scrape the page.

The below example requests an index page, and then a CSS, JS, and image file as well. You'll see the image request has a custom weight @task(4) to make it request 4x more images than the other task.


from locust import HttpUser, task, between

class QuickstartUser(HttpUser):
    wait_time = between(5, 9)

    # this will run once per wait_time
    def index_page(self):

    # this will run 4x as much as the above
    # it helps us fake 4x as many images on a page as content
    def image_selection(self):

Locust Test Example

LoadForge is powered by locust, meaning open source locust users can copy this script as well. If you are a locust user, consider importing your script to LoadForge to supercharge your testing!

Scraping pages