Example tests and snippets

WordPress Load Test Example

Load testing (aka stress testing) your WordPress Blog or CMS is made extremely easy by LoadForge, and you can test it with a free account today. We are going to be showing how to simulate a real set of users, browsing through your latest blog posts at random.

The nicest feature about this test is that it will automatically crawl valid URLs and then request them like a real user, at random. This can be applied to many types of tests.

Code example

The below code requests /blog/ and then gets all the anchor tags on that page to crawl all your latest blog posts. You can adjust this to whatever the appropriate settings would be for your site.

You should also replace the static_content with appropriate links for your theme.

from locust import HttpUser, task, between
from pyquery import PyQuery
import random

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

    def index_page(self):
        r = self.client.get("/blog/")
        pq = PyQuery(r.content)

        link_elements = pq(".blog-list-post h2 a")
        self.blog_urls = []

        for l in link_elements:
          if "href" in l.attrib:

    def on_start(self):

    def static_content(self):
        # images
        # styles
        # scripts

    def blog_post(self):
        url = random.choice(self.blog_urls)
        r = self.client.get(url)

    def home_page(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!

Websockets (SocketIO)