
LoadForge GitHub Integration
Performance testing just got a major upgrade. LoadForge is thrilled to announce a seamless GitHub integration that lets you launch...
A comprehensive guide on leveraging LoadForge for automatic fetching of web page resources like styles, javascript, images, etc., using the HttpUserWithResources plugin for Locust.
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.
LoadForge provides a seamless integration with the HttpUserWithResources
plugin for Locust, which facilitates the automatic retrieval of crucial web page resources.
While LoadForge offers the automatic retrieval of resources, it's recommended to construct your test in a manner where resources of interest are fetched manually. This is essential because LoadForge won't execute JavaScript. Hence, for AJAX resources, you might want to manually specify them. Alternatively, you can upload a browser recording in the .har format to achieve the same result.
LoadForge boasts a comprehensive wizard for test generation. This wizard can meticulously identify all the static content on your domain and incorporate it into your test file without any hassle!
The provided code snippet is designed to request the root of your website (i.e., "/"). Additionally, it will download any matches found for the regular expression: .*[^(js|png|css|gif|woff)]$
.
To put it simply, it fetches resources with file extensions: .js, .png, .css, .gif, or .woff.
from locust_plugins.users import HttpUserWithResources
from locust import task
class TestUserWithResources(HttpUserWithResources):
# The following default values can be modified as per requirements:
# bundle_resource_stats=False
# default_resource_filter=".*[^(js)]$"
@task
def include_resources_default(self):
self.client.get("/cart")
@task
def include_resources_true(self):
self.client.get("/", resource_filter=".*[^(js|png|css|gif|woff)]$")
@task
def include_resources_false(self):
self.client.get("/dashboard", include_resources=False)
LoadForge operates on the robust foundation of Locust. This compatibility ensures that users of open-source Locust can effortlessly adopt this script into their setups. If you're already leveraging Locust, think about integrating your script with LoadForge to elevate your testing experience!