I just released Tourbus 2.0! You can get it by cloning the tourbus repo in that link, or by simply installing the gem from rubyforge.
TourBus is a ruby framework for stress-testing a website. You define “Tourist” classes that “tour” their way through your site, and then tell tourbus to send a load of them at your site.
Better Syntax, and tested support for most rubies. TourBus 2.0 has been tested and found worky on:
- JRuby 1.6.0 <– strongly recommended, as it has better threading
- MRI 1.8.7p334
- MRI 1.9.2p180
- REE 1.8.7-2011.03
Upgrading from Tourbus 0.9
- Your tour classes will change; they are now called tourists and they go on tours, instead of being called tours who run tests (which really never made sense anyway)
- Open your tour class, and change it to inherit from Tourist instead of Tour.
- Change before_tests and after_tests to before_tours and after_tours.
- Rename all your test_ methods to be tour_ methods. E.g. “def test_simple” => “def tour_simple”
- That’s it! Tourbus should now run normally.
Quick and Easy Setup
gem install tourbus
Okay, let’s say you have a website running at localhost:3000 and you want to test that home.html includes the text “hi there” even when being pounded by hundreds of visitors at once. Let’s install and set up everything all at once! cd into your project folder, and do the following:
echo 'class Simple tours/simple.rb
That’s it, you now have a tourist ready to wander over to your site and request the home page. Let’s run him and see that everything’s okay:
You should see a clean run followed by a text report showing what happened. If that worked, let’s make your tourist go through the website 10 times in a row. But let’s ALSO make 100 different tourists to the same 10 laps with him, all at once:
tourbus -n 10 -c 100
Happy server stressing! Check out the README for more info.
Bonus: Isolating Tourbus
Here’s how I like to install tourbus. I cd into my development folder, and then do:
rvm install jruby-1.6.0
rvm use jruby-1.6.0
rvm gemset create tourbus
rvm gemset use tourbus
git clone git://github.com/dbrady/tourbus.git
gem install bundler
gem build tourbus.gemspec
gem install tourbus-2.0.1.gem # (update version if it changes)
Next I cd into my project and do
echo 'rvm use jruby-1.6.0@tourbus' > .rvmrc
This lets me run tourbus under jruby and its own gemset, so even if my website is running rails on MRI, I can still get the lovely JVM native threads when tourbussing my site.