I admit it: I’m test infected. I love developing test-driven, especially with Rails.
However one of the things that was annoying me since quite a while now is that startup delay you have, when you run your Rails unit or functional tests from the console. That happens because Ruby has to parse all the thousands of lines of code that is Rails and setup the whole Rails environment.
Why would you wanna do that though everytime you run a test, when the only thing you’ve changed since the last run is your code, not the code of Rails?
I have a Ruby script running in the background that starts up a Rails test environment and accepts test requests via DRb. Textmate basically just uses a little Ruby script that communicates with the server and tells it which test file (and optionally which test method) to run.
Since I’m using keyboard shortcuts to trigger the tests, you don’t quite see the difference of the delay between the two methods, but the last one is lot faster. On my Powerbook, using the first method took around three seconds for the tests to start, with the new method it almost feels like there is no delay at all.
Even when I’m using this with Textmate, it would basically work with any editor/IDE that can call a Ruby script.