Multi-Mechanize | Performance Test Framework


PyPI:multi-mechanize package
License:GNU LGPLv3
Author:Corey Goldberg - copyright © 2010-2013

Performance & Load Tests in Python

Multi-Mechanize is an open source framework for performance and load testing. It runs concurrent Python scripts to generate load (synthetic transactions) against a remote site or service.

Multi-Mechanize is most commonly used for web performance and scalability testing, but can be used to generate workload against any remote API accessible from Python.

Test output reports are saved as HTML or JMeter-compatible XML.

Discussion / Help / Updates

Install / Setup

Multi-Mechanize can be installed from PyPI using pip:

pip install -U multi-mechanize

... or download the source distribution from PyPI, unarchive, and run:

python install

(for more setup and installation instructions, see Detailed Install and Setup)

Usage Instructions

Create a Project

Create a new test project with multimech-newproject:

$ multimech-newproject my_project

Each test project contains the following:

  • config.cfg: configuration file. set your test options here.
  • test_scripts/: directory for virtual user scripts. add your test scripts here.
  • results/: directory for results storage. a timestamped directory is created for each test run, containing the results report.

multimech-newproject will create a mock project, using a single script that generates random timer data. Check it out for a basic example.

Run a Project

Run a test project with multimech-run:

$ multimech-run my_project
  • for test configuration options, see Configuration
  • a timestamped results directory is created for each test run, containing the results report.

Test Scripts

Virtual User Scripting

  • written in Python
  • test scripts simulate virtual user activity against a site/service/api
  • scripts define user transactions
  • for help developing scripts, see Scripting Guide


HTTP GETs using Requests:

import requests

class Transaction(object):
    def run(self):
        r = requests.get('')

HTTP GETs using Mechanize (with timer and assertions):

import mechanize
import time

class Transaction(object):
    def run(self):
        br = mechanize.Browser()

        start_timer = time.time()
        resp ='')
        latency = time.time() - start_timer

        self.custom_timers['Example_Homepage'] = latency

        assert (resp.code == 200)
        assert ('Example Web Page' in resp.get_data())