Multi-Mechanize - Web Performance and Load Testing Framework
View the presentation:
What is Multi-Mechanize? (the framework)
Multi-Mechanize is an open source framework for API performance and load testing. It allows you to run simultaneous python scripts to generate load (synthetic transactions) against a web site or API/service.
In your scripts, you have the convenience of mechanize along with the power of the full Python programming language at your disposal. You programmatically create test scripts to simulate virtual user activity. Your scripts will then generate HTTP requests to intelligently navigate a web site or send requests to a web service.
Multi-Mechanize uses a multi-process, multi-threaded engine to replay your scripts and generate concurrent virtual users.
Results are saved in CSV format along with an HTML report containing stats and graphs.
Optionally, results can be stored in a database:
You should be proficient with Python, HTTP, and performance/load testing to use multi-mechanize successfully.
What is python-mechanize? (scripting language: python + mechanize)
Test scripts are written in python using Mechanize or any other Python web/network module (httplib, urllib, socket, twill, etc).
- HTTP methods
- High-level hyperlink and HTML form support
- SSL support
- Automatic cookies
- Custom headers
- HTTP authentication
Multi-Mechanize is available for install via Pip, but on most systems you'll need to install matplotlib first.
Installing matplotlib on Ubuntu:
$ sudo apt-get install python-matplotlib
Methods for installing matplotlib are included in the matplotlib documentation.
A Pypi package might be forthcoming, but installation from source is easy via Pip:
$ pip install git+git://github.com/winhamwr/multi-mechanize.git#egg=multi-mechanize
Multi-Mechanize comes packaged with a test project that you can clone to see what can be done out of the box. To clone and run that project
$ multi-mechanize.py /path/to/my_test_project --clone-test-project $ multi-mechanize.py /path/to/my_test_project
Creating Your Project
Multi-Mechanize provides a
--start-project command line option to create a
default configuration and directory structure for your project
$ multi-mechanize.py path/to/my_project --start-project
This command simply copies across several things for you.
- Your project's configuration file. This file controls your test parameters.
- This directory is where your python test scripts live.
- This directory will contain the results of your tests after they're completed. Each run will have a timestamped directory with raw CSV data, and HTML summary report and PNG files containing graphs.
Configuring Your Project
config.cfg file defines what will happen in your test run.
You'll set how long the tests should last, how many threads should be used, and
what test scripts should be run, along with various other parameters.
For details, see the Configuration File Format documentation.
Developing Test Scripts
Test scripts are what define the actions your virtual users should perform on
a test run. They also define what timers you should measure. At the core, these
are just python scripts containing a
Transaction class and that stores any
timers in a
To get started, you can simply copy some of the example scripts from the test project.
Feel free to post a message to the multi-mechanize users discussion group. questions, bugs, patches, collaboration, comments, welcome...
If you have any suggestions, bug reports or annoyances please report them to the Multi-Mechanize Bug Tracker.
This software is licensed under the GNU LGPL v3. See the
file in the top distribution directory for the full license text.