Autotesting With Doom-Guy

This post is inspired by one of the over-3-year-old-posts about using Autotest with Growl to show nice notifications about passing and failing tests.

Doom-Guy is here!

I’ve created a small gem for you to get the same helper for your testing needs. It is called autotest-doom which works with RSpec. Read below for installation and configuration instructions.

This is how it looks under Windows when everything is green and Doom-Guy is happy:

all passing

He looks a little bit hesitant, if something has failed:

slightly failing

It looks like his day has gotten even worse:

more failures

I’d say that there is definitely some visible blood when you’re having this many failures:

little bloody

You’d better get yourself together and fix those failing tests now or he’s going to die!

not a good day

And he’s dead… Do you really want to be such a lousy software developer?

status

Maybe, just maybe, if you’ll fix all the tests he will be alive again and you’ll be a lifesaver. Wouldn’t that just feel awesome?

Installation & Configuration

In today’s Ruby world things are a little different compared with the previously mentioned old post. My approach is to support not just OS X, but also Windows and Linux. It is possible via help of Test Notifier gem, which has created a clean API by using abstraction layer for using different tools to show notifications. It uses Growl under OS X, Libnotify among many others under Linux and Snarl under Windows.

The following instructions are for Windows, but they’re really similar to other OS-es too. Just refer to Notifier’s documentation about installing correct notifier tool for your OS and you’re ready to go.

  1. Download Snarl from it’s website and install it.
  2. Install ruby-snarl and test-notifier gems:

    gem install ruby-snarl test_notifier

  3. Install autotest and autotest-doom gems:

    gem install autotest autotest-doom

  4. Create .autotest file into your project’s root directory with the following contents:

    require "autotest/doom"

  5. And start testing!

That’s it! Make sure that you’re not killing that poor old Doom-Guy too often and everyone is happy!