Reprocessed, by Matt Patterson

Something approaching a weblog

testing

Introducing ModelMocker

While writing Rails apps, I've written several variants on the 'give me an ActiveRecord instance that can't talk to the DB' theme over the last couple of years while writing tests or specs for an app. The basic pattern is a pretty good one - it guarantees you a certain degree of test isolation for your unit tests or specs, when you need it. And, because you're make specific instances isolated, you can get to the DB if you need to.

Snow Leopard, Firefox, and Selenium

I've got a longer post about setting up your Cucumber/Selenium environment coming, but since this is a hot issue I'd thought I'd address it. In short: There's a problem running the firefox.sh script on Mac OS X 10.6, which is the definitive way for things to invoke Firefox. [Selenium RC] [1] runs firefox.sh to run tests, and Cucumber in turn uses Selenium RC. The result is that if you use Cucumber with Selenium and upgrade to 10.6, all your Selenium tests fail. The problem is detailed in Firefox's [Bugzilla bug #513747] [2] and Selenium's [bug SRC-743] [2a]. After a bit of poking about, I found a workaround. It's not great but it does get you going again...

Setting up a more-integrated Selenium, Cucumber, and Rails

I've been using [Selenium] [1] and [Cucumber] [2] together for a few months now, and I've really enjoyed being able to actually test the Ajaxy parts of my apps. The initial setup was a bit of a pain, and most of the tutorials I found advocated completely separate and parallel Selenium and non-Selenium Cucumber feature directories. I didn't want this, worked out a more integrated way, which changes to Cucumber have since allowed me to make even more straightforward. I'm going to assume you want to set up Selenium with Cucumber, or want to improve your setup, rather than introduce either thing.

Easy Rails CI with Hudson

For a long time I've thought that it would be a good idea to have a Continuous Integration server that could run all the tests for a project on checkin to source control. Until I started making use of Cucumber I didn't really have a full test run that took long enough to make buying a separate CI server feel more like an investment than an indulgence.

Not forgetting:

This page is: