Molotov is a simple, Python 3.7+ tool for writing load tests. It is built upon `asyncio` and `aiohttp.client`, enabling highly concurrent testing scenarios. The current version is 2.6, released in October 2022. While there isn't a fixed release cadence, updates address Python compatibility, dependency changes, and new features.
pip install molotovVerified import paths — ran on the pinned version, not inferred.
This quickstart defines two asynchronous scenarios that make GET requests to a target API. Each scenario receives an `aiohttp.ClientSession` object. The `weight` parameter controls the probability of a scenario being picked. To run, save this as `loadtest.py` and execute from the terminal.
Upgrade your Python environment to 3.7+ (e.g., Python 3.10 for optimal compatibility with Molotov 2.5+).
Review any custom multiprocessing logic in your test scripts; ensure compatibility with the `multiprocess` library.
If you were relying on `aiomeasures`, migrate your metrics collection to use `aiodogstatsd` or other supported alternatives.
Run Molotov on Linux or macOS environments for reliable load testing, or within a Docker container.
Remove `--disable-dns-resolver` from your Molotov command-line arguments. Configure `aiohttp` directly if specific DNS behavior is required.
Define your scenario functions as `async def my_scenario(session): ...`
Run `pip install molotov` to install the library.
Change the function definition from `def` to `async def`.
Install `certifi` and ensure your Python environment is configured to use it, or run `pip install certifi` and re-run your tests. In some cases, you might need to run a specific `Install Certificates.command` on macOS.