index.md (2240B)
1 --- 2 title: "How (& Why) to Run Autotest on your Mac" 3 date: 2009-06-19T00:00:00+00:00 4 draft: false 5 canonical_url: https://www.viget.com/articles/how-why-to-run-autotest-on-your-mac/ 6 --- 7 8 If you aren't using Autotest to develop your Ruby application, you're 9 missing out on effortless continuous testing. If you'd *like* to be 10 using Autotest, but can't get it running properly, I'll show you how to 11 set it up. 12 13 Autotest is a fantastic way to do TDD/BDD. Here's a rundown of the 14 benefits from the [project 15 homepage](http://www.zenspider.com/ZSS/Products/ZenTest/): 16 17 - Improves feedback by running tests continuously. 18 - Continually runs tests based on files you've changed. 19 - Get feedback as soon as you save. Keeps you in your editor allowing 20 you to get stuff done faster. 21 - Focuses on running previous failures until you've fixed them. 22 23 Like any responsible Ruby citizen, Autotest changes radically every 24 month or so. A few weeks ago, some enterprising developers released 25 autotest-mac (now 26 [autotest-fsevent](http://www.bitcetera.com/en/techblog/2009/05/27/mac-friendly-autotest/)), 27 which monitors code changes via native OS X system events rather than by 28 polling the hard drive, increasing battery and disk life and improving 29 performance. Here's how get Autotest running on your Mac, current as of 30 this morning: 31 32 1. Install autotest: 33 34 ``` 35 gem install ZenTest 36 ``` 37 38 2. Or, if you've already got an older version installed: 39 40 ``` 41 gem update ZenTest 42 gem cleanup ZenTest 43 ``` 44 45 3. Install autotest-rails: 46 47 ``` 48 gem install autotest-rails 49 ``` 50 51 4. Install autotest-fsevent: 52 53 ``` 54 gem install autotest-fsevent 55 ``` 56 57 5. Install autotest-growl: 58 59 ``` 60 gem install autotest-growl 61 ``` 62 63 6. Make a `~/.autotest` file, with the following: 64 65 ```ruby 66 require "autotest/growl" 67 require "autotest/fsevent" 68 ``` 69 70 7. Run `autotest` in your app root. 71 72 Autotest is a fundamental part of my development workflow, and well 73 worth the occasional setup headache; give it a shot and I think you'll 74 agree. These instructions should be enough to get you up and running, 75 unless you're reading this more than three weeks after it was published, 76 in which case all. bets. are. off.