← Load Test Directory

Including Static Content

Learn how to include static content in your LoadForge load tests to measure the capacity of your web servers alongside the dynamic content.

You are now browsing the LoadForge locust test directory. You can use these tests as a starting point for your own tests, or use our AI wizard to generate one automatically.



Modern web pages often serve a mix of dynamic and static content. While dynamic content, such as database-driven content, is the primary source of load, static content (like images, stylesheets, and JavaScript) can also influence server performance. While it's common for LoadForge tests to exclude these static assets, testing them can offer a comprehensive view of a site's performance.

Did You Know?

If you're seeking automation, LoadForge offers a Wizard with an option to include static content. When activated, the Wizard generates a test that encompasses your images, stylesheets, and JavaScript files. Check out how to scrape the page for more.

Example: Load Testing Static Content

In the example provided, we illustrate a test that requests an index page followed by requests for a CSS file, a JS file, and an image. Notice the image request; it has a custom weight @task(4). This weight ensures that the image is requested four times more frequently than other assets, simulating a scenario where a page might have multiple images compared to other static content.

Test Script

from locust import HttpUser, task, between

class QuickstartUser(HttpUser):
    # Defines the wait time between tasks
    wait_time = between(5, 9)

    # This task fetches the index page and its associated JS and CSS files
    def index_page(self):

    # This task emulates loading an image and is set to run 4 times as frequently
    def image_selection(self):

For Open Source Locust Users

Did you know? LoadForge is built upon the robust foundation of locust.io. This means if you're an existing locust user, you can seamlessly copy and use this script. Want to amplify your load testing capabilities? Import your script to LoadForge and experience advanced testing features!

By including static content in your tests, you ensure that your server's full capacity—across both dynamic and static content—is measured, helping you prepare for real-world scenarios.

Ready to run your test?
Start your first test within minutes.