Corey Goldberg Boston Python User Group Dec 19, 2011 - Cambridge, MA
Virtual User scripts run in parallel (with timers and assertions):
"[Web] Performance and Load Testing Framework"
(probably moving to a dedicated web home soon)
"Python framework for performance and load testing remote APIs"
You write the virtual user (client) scripts in Python, so any remote protocol/lib you want:
- Virtual User Test Scripts
- Config File
- HTML Report with PNG images (graphs)
- XML Report (JMeter JTL format)
Each test script must implement a Transaction() class. This class must implement a run() method.
During a test run, your Transaction() class is instantiated once, and then its run() method is called repeatedly:
class Transaction(object): def __init__(self): # this gets called once def run(self): # this gets called repeatedly
A full script that will issue an HTTP GET using urllib2:
import urllib2 class Transaction(object): def run(self): url = 'http://www.example.com/' urllib2.urlopen(url).read()
mechanize request with assertions:
import mechanize class Transaction(object): def run(self): br = mechanize.Browser() br.set_handle_robots(False) resp = br.open('http://www.example.com/') resp.read() assert (resp.code == 200), 'Bad HTTP Response' assert ('Example Web Page' in resp.get_data()), 'Failed Content Verification'
sample config file:
[global] run_time: 600 rampup: 600 results_ts_interval: 60 console_logging: off xml_report: on [user_group-1] threads: 25 script: view_all_new.py [user_group-2] threads: 25 script: view_all_top.py ...
Sample Report: http://tinyurl.com/mm-results
Hudson Helper (Android App) on DroidX:
Jenkins-CI + Multi-Mechanize