Case Study: Mechanize Performance/Load Testing User Login with CSRF Token Protection

How to use Mechanize for a website’s performance and load testing

Zhimin Zhan

--

A repost of my daughter’s article, which was based on my book: Practical Performance and Load Testing”. I made minor modifications and added a few notes.

Mechanize is a library for automating interactions with websites, without a browser involved. Mechanize is implemented in many scripting languages, such as Perl (WWW::Mechanize), Python (mechanize) and Ruby. In this exercise, I will use it for performance/load testing in Ruby.

If you are new to Ruby, don’t need to worry about learning the Mechanize syntax, just run the sample scripts. The purpose is to get you a feel of scripting a performance/load test using Mechanize.

Table of Contents:
·
Preparation
Login
Add assertion
Debugging
Add measurements
·
Performance Testing
·
Simple Load Testing
Generate load
Measure timings
Compare Load Test Results
Failure to load test AJAX

--

--

No responses yet