Quick and dirty continuous testing with Ruby on Rails

I like the idea of continuous testing: seeing that you broke it, the moment you broke it and the same for fixing. There are some tools to do it, but since they are not packaged, yet, for my operating system of choice I went through the quick and dirty route:

watch -n 5 rake test 2> /dev/null

“watch” is a nice program that can run another program every two seconds continuously. I often use it like this:

watch ls -l big-file-being-copied.txt

to see how a long file-system-process is going. Using the parameter “-n 5″ I tells it to run every 5 seconds because 2 seconds is too short for running all the tests of my application. You should change it according to your testing times.

The last part, “2> /dev/null”, is to avoid getting stderr output from “rake test”, it confuses watch.

Some notes before I get the messages I know I might get. I know there’s an easy way to install ZenTest with gems, but so far I couldn’t make it work nicely with the operating system packages. And I like the operating system packages, I don’t want to remove them all and just use gems. If you want to learn more about ZenTest’s autotest, there’s seems to be a nice post: autotest-rails.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s