Sunday, December 27, 2009

My dot-Autotest

Among the things that make me ga-ga for Ruby testing libraries is the ZenTest gem, which includes a super handy utility called 'autotest'. Autotest is meant to be run from the top of your project directory and it will search through your /test directory and run all test files it finds there (and report passes/failures on the console). My own development preference is writing specifications for my software using RSpec, which includes a tiny utility script called 'autospec' that enables 'autotest' to run anything it finds under the /spec directory of your project environment. As well, setting an environment variable called AUTOFEATURE=true tells autotest to search through your /features directory and run all your Cucumber features after file-system changes (this capability is added by Cucumber and not actually part of the ZenTest gem).

I have been running autospec nonstop as I tinker with a Sinatra app I have been writing. The normal behavior for autospec is that it runs all specs & features and then stops, watching the filesystem for any file changes that trigger it to run specs again. Recently, though, I noticed that the specs would start running and then go into an infinite loop of running and running and running... At first I thought that I'd updated a gem in the vendor directory of my Sinatra app that broke autospec somehow. After doing a lot of tinkering, I tracked it down to a Webrat log file that gets updated each time my Cucumber specs make it all the way through the login feature of my web app.

Autotest includes a configuration capability that lets you specify which file updates it should ignore (i.e. which files can be updated without triggering an execution of all the specs for your project). These exceptions can be declared in a .autotest file that needs to reside in the home directory of your development environment. I think I have covered all the bases for things that I want to keep from triggering my autospec runs. Here is what my file looks like:

The 'autotest/growl' require is so that I can see growl popups when my specs pass or fail. The gem for this is 'autotest-growl'.

UPDATE - 12/28/09: The 'autotest' script supports a '-v' flag which will cause it to report what file it saw changed to trigger your last test run. I only learned about this flag thanks to a comment on this original post by the great Ryan Davis.

18 comments:

Dreamr said...

How did you find out what file was changing?

thanks

zenspider said...

I don't know about autospec, as it isn't actually part of zentest (unlike what the article claims, it ships with rspec, not zentest), but if you run `autotest -v` it will print out what is triggering a run.

Mario said...

My original post was loaded with incorrect assumptions. Thanks to zenspider for pointing out "autotest -v". That would have saved me loads of time. I have updated my post with more accurate attribution.

boniourkee said...

wonderful ..................................................

オテモヤン said...

オナニー
逆援助
SEX
フェラチオ
ソープ
逆援助
出張ホスト
手コキ
おっぱい
フェラチオ
中出し
セックス
デリヘル
包茎
逆援
性欲

瘋狂的 said...

我愛那些使自己的德行成為自己的目標或命定的人 ..................................................

開心唷 said...

thank you for you to make me learn more,thank you∩0∩

少菁 said...

wonderful...................................................

generic propecia said...

Hello people want to express my satisfaction with this blog very creative and I really like the views of the focus very good indeed Thank you for the helpful information. I hope you keep up the good work on making your blog a success!

Volker from Germany said...

Hallo, Ich haben eben Eure Internetseite besucht und nutzen sogleich die Gelegenheit,euch auch einen Gruß aus Deutschland in Eurem Gästebuch zu hinterlassen. P.S. Kommt uns doch auch mal besuchen
Urlaub an der Ostsee
oder Nordsee

Firesales Costa Rica said...

Hello .. firstly I would like to send greetings to all readers. After this, I recognize the content so interesting about this article. For me personally I liked all the information. I would like to know of cases like this more often. In my personal experience I might mention a book called Firesales Costa Rica in this book that I mentioned have very interesting topics, and also you have much to do with the main theme of this article.

Anonymous said...

Magnificent job! The comprehensive data provided was very beneficial. I really hope you sustain the good job done.
miami beach locksmith
Wellington Locksmith
Locksmith Berkeley CA
RedwoodCity locksmith
Sunnyvale locksmith
Milpitas locksmith
miami beach fl locksmith
pembroke pines locksmith
plano tx locksmith
locksmith miami
locksmith miami
irvine locksmiths
irvine ca locksmith
plano locksmiths
miami fl locksmith
locksmith miami fl
Locksmith Hialeah FL
Aventura FL locksmith
locksmith miami beach
Hialeah FL Locksmith
locksmith pembroke pines

Nike Mercurial Vapor Superfly said...

Ah good exciting content! Will always come to our attention. To bring you good news-works perfect! Nike Football Cleats best shoes 2011!! And Nike Mercurial Vapor Superfly.Nike soccer cleats with New nike soccer shoes or Nike mercurial soccer cleats .

Mobile Application said...

My friend recommended to this blog.... you have some awesome articles shear. keep it up the great work

android application | android web application

owais said...

Wonderful post.Thanx for sharing.
Download Spider man 3 Game | Download Ea sports cricket 2011 | Download free Full version Games | Download UEFA Euro 2012

China tours said...

This is so much more than i needed!!! but will all come in use thanks!!I am a china tour lover,You can learn more: China travel packages | Asia tour packages | China city tour packages

Learn Chinese said...

I'm learning to speak Chinese because I believe it's the only way to really learn about China.When I was searching for a place to learn to speak Chinese, I called several schools. Hanbridge was the best because they had excellent teachers and a very friendly and welcoming spirit . I really appreciate the opportunity to learn here and would recommend Hanbridge to others.

Thinking said...

Thanks for pointing out the usefulness of this tool.