File Management
Upload and use data files in your load tests
LoadForge allows you to upload, create, and manage files for your load tests. You can upload CSV, JSON, or TXT files (maximum 5MB) to use in your test scripts.
A file being managed in LoadForge
How Files Work in LoadForge
Files are automatically uploaded to your load generators and stored in the files/{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
Example 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
Need Further Assistance?
If you have questions about using files in your load tests or need help with a specific implementation, don’t hesitate to contact us. We’re here to help you get the most out of LoadForge.