How (& Why) to Run Autotest on your Mac
If you aren’t using Autotest to develop your Ruby application, you’re missing out on effortless continuous testing. If you’d like to be using Autotest, but can’t get it running properly, I’ll show you how to set it up.
Autotest is a fantastic way to do TDD/BDD. Here’s a rundown of the benefits from the project homepage:
- Improves feedback by running tests continuously.
- Continually runs tests based on files you’ve changed.
- Get feedback as soon as you save. Keeps you in your editor allowing you to get stuff done faster.
- Focuses on running previous failures until you’ve fixed them.
Like any responsible Ruby citizen, Autotest changes radically every month or so. A few weeks ago, some enterprising developers released autotest-mac (now autotest-fsevent), which monitors code changes via native OS X system events rather than by polling the hard drive, increasing battery and disk life and improving performance. Here’s how get Autotest running on your Mac, current as of this morning:
gem install ZenTest
Or, if you’ve already got an older version installed:
gem update ZenTest gem cleanup ZenTest
gem install autotest-rails
gem install autotest-fsevent
gem install autotest-growl
~/.autotestfile, with the following:
require "autotest/growl" require "autotest/fsevent"
autotestin your app root.
Autotest is a fundamental part of my development workflow, and well worth the occasional setup headache; give it a shot and I think you’ll agree. These instructions should be enough to get you up and running, unless you’re reading this more than three weeks after it was published, in which case all. bets. are. off.