Ruby / Rails: Zen Testing With Autotest and XOSD

Lately I watched the Rest series of excellent Peepcode screencasts and fell in love with that nice marriage of Autotest and Growl they have on Mac.

If you don’t know what Autotest is, imagine the RSpec tester spinning in the background and watching the files you change. Once it sees something new, it runs corresponding specs and displays all usual “X examples, Y failures, Z pending” in its output. Then it looks for more changes and makes another specs run. Pretty useful.

The integration with Growl I referred to brings it to a next quality level – it lets you continue working and get the results of automated specs run as a Growl balloon. It looks like this: you do some changes in the editor, save a file, continue working and then, a couple of seconds later (when the testing is finished), a nice balloon appears reporting the status of the spec run against your new sources; with cool smiles and color.

We, Unix users, don’t have Growl, but we do have a secret weapon – XOSD – which is almost the same. The only difference is that it’s just a text-over-everything tool: no images, no background fills etc. However, for our purposes it works just fine.

I started by picking a Growl-Autotest integration script from wiki, then installed an xosd_cat console tool that talks to XOSD library (in Ubuntu you need xosd-bin package for this), and changed the script a bit to call this tool instead of Growl notifications.

Now I have very cute reports from the Autotest running in the background too.

Please download the “Autotest + XOSD” script and let me know what you think. Remember to put the “dot_autotest” from the archive into your home directory and rename it to “.autotest”.