
A file being managed in LoadForge
How Files Work in LoadForge
Files are automatically uploaded to your load generators and stored in thefiles/{file_name} directory. This makes it easy to access your data files from within your load test scripts. This feature is particularly useful for:
- Large user lists for authentication testing
- Test datasets for API or form submissions
- Configuration files for complex test scenarios
- CSV data for data-driven testing
Uploading Files
You can upload files through the LoadForge interface:- Navigate to the File Management section
- Click Upload File or Create Blank File
- Select your file or create a new one
- The file will be available in the
files/directory on all load generators
Using Files in Locust Tests
Here are some examples of how to use uploaded files in your Locust test scripts:Loading a JSON User List
userlist.json file:
Reading CSV Data for Test Scenarios
Using a Configuration File
Best Practices
- File Size: Keep files under 5MB for optimal performance
- File Format: Use structured formats like JSON or CSV for easy parsing
- Error Handling: Always include error handling when reading files
- Caching: Load files once during startup rather than for each request
- Random Selection: For user credentials, randomly select from a large pool to simulate realistic behavior