Developer friendly load testing framework
When browsing the web with the Developer Tools open you can record the Network Activities (requests perform by your browser & responses you get from servers). Then you can export all these data into an HAR file (Http ARchive). With har2locust you can convert HAR file into valid python code that reproduce the requests perform by your browser.
har2locust builds upon har2py, modified to generate a locustfile instead of a basic Python file.
Note: It is currently in early beta. It mostly works, but there may be changes to behaviour and interface without notice. If you encounter an issue, PRs are very welcome.
pip install har2locust
This will also install locust and locust-plugins, because they are needed to run the generated locustfiles.
Navigate the web with your browser while recording your activity. Then save the data in HAR file. Here is an example with Chrome Devs Tools
har2locust myharfile.har > locustfile.py.
> har2locust -h usage: har2locust [-h] [-t TEMPLATE] [-f FILTERS] [--version] input positional arguments: input har input file options: -h, --help show this help message and exit -t TEMPLATE, --template TEMPLATE jinja2 template used to generate locustfile. Default to locust.jinja2 -f FILTERS, --filters FILTERS commas value separeted string of the resource type you want to include in py generated code. Supported type are `xhr`, `script`, `stylesheet`, `image`, `font`, `document`, `other`. Default to xhr,document,other. --version, -V show program's version number and exit
- har2locust also reads two files, .urlignore and .headerignore (from your current directory). Populate them with regexes to filter any unwanted requests or headers from your recordings. Some headers are always ignored (cookie, content-length and chrome's "fake" headers) Here are some examples: .urlignore, .headerignore
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for har2locust-0.2.0-py3-none-any.whl