Automatic rails testing with autotest

I found a really good way to speed up your workflow: a library called autotest that automatically (and intelligently) triggers the tests in your Ruby on Rails project whenever it detects files that are modified.

This is great because it means that you can fiddle around with your code with a greater level of confidence, because you know that the moment you break existing functionality, you will be alerted.

You can install autotest simply by installing the ZenTest gem:

gem install ZenTest

And then type the following from your Rails project directory:

autotest -rails

I even found a way in which you can set up autotest to use your desktop notification system to alert you of when tests have passed or failed, making it even more visible to you as you code. I am running Ubuntu, so I set it up through the Gnome notification system, but according to this article on getting started with autotest you can also enable this on OSX and Windows.

autotest in action with Gnome notifications

Leave a Reply