Way beyond cool: autotest + growl + Doomguy
Here’s something that will amaze your friends to no end. Your male geek friends, that is. Type some code in your editor, save file and… a smiling Doom Marine tells you that all your tests passed. Or, if there were some errors, the Marine is bleeding. The more errors, the more blood. Is it cool or is it cool?
Just look at the screenshots. First: Marine is happy that your tests passed.
Next: there were some failures. The blood starts to flow!
Even more failures, even more blood.
Oh my, it looks like we killed him, we bastards!
How to do this? Read on.
Inspiration
First, go and read Autotest Growl Pass/Fail Notifications by John Nunemaker. This is where I got inspiration from (the comments section, specifically). The Doom Marine head sprites can be found here http://sdb.drshnaps.com/sheets/Misc/Misc/Other/Doom-Head.png.
Prerequisites
For this all to work, you need Mac OS X, Growl notification application (with growlnotify), and autotest — automated testing utility. If you want it to look exactly as on screenshots above, set display style to ‘Music video’ in your Growl preferences.
The script
Now, if all prerequisites are installed, copy following script (this is John Nunemaker’s script with my tiny modifications) and save it as ~/.autotest file.
require 'autotest/redgreen'
require 'autotest/timestamp'
module Autotest::Growl
def self.growl title, msg, img, pri=0, sticky=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
end
Autotest.add_hook :ran_command do |at|
image_root = "~/.autotest_images"
results = [at.results].flatten.join("n")
output = results.slice(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/)
if output
if $~[3].to_i > 0 || $~[4].to_i > 0
cnt = [(9 + $~[3].to_i + $~[4].to_i) / 10 * 10, 50].min
growl "FAIL", "#{output}", "#{image_root}/fail#{cnt}.png", 2
else
growl "Pass", "#{output}", "#{image_root}/pass.png"
end
end
end
end
My addition is that depending on number of your failures and errors, one of 5 different failure icons is chosen.
The icons
You can download them from RapidShare (please let me know if the file is gone). The zip file contains one smiling Marine, five differently bleeding Marines and the above .autotest script in case you have any trouble with copying & saving stuff. After saving the zip file in your home directory, fire up your console and say:
~ > unzip doom.zip Archive: doom.zip inflating: .autotest inflating: .autotest_images/fail10.png inflating: .autotest_images/fail20.png extracting: .autotest_images/fail30.png extracting: .autotest_images/fail40.png inflating: .autotest_images/fail50.png extracting: .autotest_images/pass.png
And that’s all. Try running autotest and enjoy endless Doomguy goodness.
So you don’t use autotest?
Are you of those that refuse to accept the goodness of automated test running? Or maybe you don’t use Ruby at all? Don’t despair. As you can see the heart of this is the neat growlnotify utility. It should be as easy to add it to rake test. Or to report results of your ant or make build. Or anything really.
If you have any problems or questions, feel free to comment. I will be also glad to hear of any additional ideas where this could be used.
If you cannot download the above mentioned zip file from RapidShare, here are the icons again. Click on each and save to ~/.autotest_images:






Add to:
digg
reddit
del.icio.us








I sent Doomworld a link to this and they featured it! http://www.doomworld.com/vb/doomworld-news/40885-the-doomguy-is-a-pedagogue/ .
Klinical said this on 2007-07-31 at 09:38:44
This is awesome. Perhaps you can pull together the doom sound effects for my new autotest plugin :)
http://fozworks.com/2007/7/28/autotest-sound-effects
foz said this on 2007-07-31 at 19:13:57
The sound effects would be cool, but a little troublesome in the long run. Imagine a team of four coders running autotest with Doom sound effects simultaneously :)
szeryf said this on 2007-07-31 at 19:26:18
Exactly… “are you guys havin’ a LAN party? We gotta ship ASAP!!”
“Nope we’re coding! Serious!”
Jamie Flournoy said this on 2007-07-31 at 23:45:18
Wow. Awesome. Maybe I should comment on more blogs about stuff I want and they’ll appear.
Dylan Egan said this on 2007-08-01 at 08:40:42
13c13
output = results.slice(/(\d+)\sexamples,\s(\d+)\sfailures/)
15,16c15,16
0 || $~[4].to_i > 0
if $~[2].to_i > 0
> cnt = [(9 + $~[2].to_i) / 10 * 10, 50].min
To get it going with rspec.
Dylan Egan said this on 2007-08-03 at 06:10:37
Ah crap
13c13
< output = results.slice(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/)
—
> output = results.slice(/(\d+)\sexamples,\s(\d+)\sfailures/)
15,16c15,16
< if $~[3].to_i > 0 || $~[4].to_i > 0
< cnt = [(9 + $~[3].to_i + $~[4].to_i) / 10 * 10, 50].min
—
> if $~[2].to_i > 0
> cnt = [(9 + $~[2].to_i) / 10 * 10, 50].min
Dylan Egan said this on 2007-08-03 at 06:11:38
we’re gonna need a duke nukem version of this. can anyone say “Groovy.”
matt said this on 2007-08-06 at 22:16:03
Anyone wanna repost the icons? The file-upload link is dead.
gordon said this on 2007-08-14 at 05:58:42
I re-uploaded the zip with icons, so it should last another few weeks. Anyone care to suggest a site where the files last longer?
Sadly I cannot upload zip directly to wordpress.
I could post all the icons as png files, but that would require clicking and saving each one separately.
szeryf said this on 2007-08-14 at 09:38:52
host the files on amazon s3
Alex Egg said this on 2007-09-27 at 04:26:19
P.S.: Can you post the icons again?
Alex Egg said this on 2007-09-27 at 19:18:01
The icons link works for me. But if you have any problems, here’s a new link: http://files-upload.com/files/527214/doom.zip
szeryf said this on 2007-09-28 at 09:34:37
I didn’t realize they were hidden in the folder!
Alex Egg said this on 2007-09-29 at 04:50:49
Sorry. You can not download this file today. Download traffic for your country is empty.
How about Radpidshare.com?
art said this on 2007-10-08 at 14:08:04
Sorry there was a typo: http://www.Rapidshare.com
art said this on 2007-10-08 at 14:08:47
Art: the icons link is still working for me :)
I also posted another link 3 comments above and it works, too.
But if you have any problems, here’s your Rapidshare link: http://rapidshare.com/files/61103292/doom.zip.html
szeryf said this on 2007-10-08 at 14:23:50
It says: “Download traffic for your country is empty”. I guess your country is not affected :).
However, rapidshare is a great site for sharing and there are no time limitations afaik.
Thank you for the promt reply, but now I have a new problem. Nothing happens when tests fails or pass. I see no notification. Any idea how to get some response from autotest? Some error log or something?
art said this on 2007-10-08 at 15:22:52
Sorry for spamming again, but now it works. I created the .autotest file myself before. Now I use yours from the zip file.
art said this on 2007-10-08 at 15:32:33
Wierz mi lub nie, gęba kolesia z Dooma spowodowała, że będę dążył do 100% obłożenia kodu testami/specami.
Jacek Becela said this on 2007-10-11 at 17:14:24
[...] Way beyond cool: autotest + growl + Doomguy « require ‘brain’ (tags: autotest ruby rubyonrails testing rails doom growl) [...]
Mark’s Link Blog » links for 2007-12-13 said this on 2007-12-13 at 08:23:17
Ohhh GREAT!
TO THE AUTHOR:
It would be possible to make something similar for Linux?
Yami said this on 2008-04-18 at 20:46:19
I create a gem to do it in a Linux and Mac.
http://www.nomedojogo.com/2008/06/17/autotest-notification-doom-edition/
Carlos Brando said this on 2008-07-06 at 00:36:15
Why be limited to on red/green sound. Why not try the playlist :)
http://www.metaskills.net/2008/4/6/autotest-playlist-for-red-green-feedback
Ken Collins said this on 2008-07-07 at 14:18:33
[...] as you make changes. And if you like to have your tests running automatically and you use Growl – this might be for [...]
Ruby Tuesday #13 : Testing « Re.Mark said this on 2008-07-08 at 21:26:47
Thanks for the tips
joban said this on 2008-12-31 at 12:11:50
You might want to check http://github.com/Hates/doomguy-growl-autotest/tree/master. It looks like somewhat extended version of my idea.
szeryf said this on 2009-02-16 at 12:06:57
this is really really cool man!… thanks for the idea.
brady said this on 2009-03-24 at 19:23:51
[...] took and made a DoomGuy version of autotest growl that completely rocks. The more specs that fail the worse your DOOM [...]
Fun with Autotest | Derek Neighbors said this on 2009-11-17 at 01:07:14
[...] github. After a tiny tweaking I was even able to get it to work with Przemysław Kowalczyk’s Doom Guy. I’ve packaged it all up and put it on Github. [...]
RSpec + Autotest + Growl + Doom Guy said this on 2009-11-19 at 18:22:14