Break Things Faster with Ruby Parallelization

Posted by Dylan in Selenium ResourcesSoftware Development & Testing

You're probably wasting two things when you're testing. Your time... because the other thing is your extra CPUs. Any time you're waiting on a relatively slow resource, your CPU is just sitting there, twiddling its silicon thumbs. If you're only using one CPU core at a time, the other cores are doing much the same. Unfortunately for web developers who do things involving CRUD operations, slow resources includes databases. Most unfortunately for you, Dear Reader (and us, Dear... Us), they also include the browsers you're integrating with for Selenium testing.

Source: http://www.flickr.com/photos/calliope/440681335/

One of the best ways to get more test for your tokens is to run more tests at once. If you've got several tests going, even if some are waiting for one slow resource, the others can use the CPU. The more tests you can run at once, the shorter your test cycles will be, especially if you could, say, spin up more then one copy of the slow resource to test with (Psst: I'm talking about Sauce Labs Parallelization). I've been looking for ways to make parallelization easier when testing with Ruby, and I stumbled across the Parallel Tests gem. It's actively developed, has some nice documentation and integrates with rspec, rspec-rails and test:unit. Their benchmarks show that using the gem, the Rails ActionPack test suite time was cut in half, from 88 seconds to 44, with just 4 test runners. This, conveniently, is the number of parallel tests you can run with a Mild plan.

Source: http://www.flickr.com/photos/59937401@N07/5857826966/

So for many of you, there's already a possibility of making your tests take half the time. Which means you can run twice as many. Which means a much faster turnaround time for TDD, BDD, and release testing. I'd say that's a win.

Discuss: Break Things Faster with Ruby Parallelization
0 Comments

Free Trial

Get access to a free 14-day trial version, or contact Sales for more information.