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 endMy 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.pngAnd 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 torake test
. Or to report results of yourant
ormake
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
July 31st, 2007 at 09:38:44
I sent Doomworld a link to this and they featured it! http://www.doomworld.com/vb/doomworld-news/40885-the-doomguy-is-a-pedagogue/ .
July 31st, 2007 at 19:13:57
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
July 31st, 2007 at 19:26:18
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 :)
July 31st, 2007 at 23:45:18
Exactly… “are you guys havin’ a LAN party? We gotta ship ASAP!!”
“Nope we’re coding! Serious!”
August 1st, 2007 at 08:40:42
Wow. Awesome. Maybe I should comment on more blogs about stuff I want and they’ll appear.
August 3rd, 2007 at 06:10:37
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.
August 3rd, 2007 at 06:11:38
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
August 6th, 2007 at 22:16:03
we’re gonna need a duke nukem version of this. can anyone say “Groovy.”
August 14th, 2007 at 05:58:42
Anyone wanna repost the icons? The file-upload link is dead.
August 14th, 2007 at 09:38:52
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.
September 27th, 2007 at 04:26:19
host the files on amazon s3
September 27th, 2007 at 19:18:01
P.S.: Can you post the icons again?
September 28th, 2007 at 09:34:37
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
September 29th, 2007 at 04:50:49
I didn’t realize they were hidden in the folder!
October 8th, 2007 at 14:08:04
Sorry. You can not download this file today. Download traffic for your country is empty.
How about Radpidshare.com?
October 8th, 2007 at 14:08:47
Sorry there was a typo: http://www.Rapidshare.com
October 8th, 2007 at 14:23:50
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
October 8th, 2007 at 15:22:52
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?
October 8th, 2007 at 15:32:33
Sorry for spamming again, but now it works. I created the .autotest file myself before. Now I use yours from the zip file.
October 11th, 2007 at 17:14:24
Wierz mi lub nie, gęba kolesia z Dooma spowodowała, że będę dążył do 100% obłożenia kodu testami/specami.
December 13th, 2007 at 08:23:17
[…] Way beyond cool: autotest + growl + Doomguy « require ‘brain’ (tags: autotest ruby rubyonrails testing rails doom growl) […]
April 18th, 2008 at 20:46:19
Ohhh GREAT!
TO THE AUTHOR:
It would be possible to make something similar for Linux?
July 6th, 2008 at 00:36:15
I create a gem to do it in a Linux and Mac.
http://www.nomedojogo.com/2008/06/17/autotest-notification-doom-edition/
July 7th, 2008 at 14:18:33
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
July 8th, 2008 at 21:26:47
[…] as you make changes. And if you like to have your tests running automatically and you use Growl – this might be for […]
December 31st, 2008 at 12:11:50
Thanks for the tips
February 16th, 2009 at 12:06:57
You might want to check http://github.com/Hates/doomguy-growl-autotest/tree/master. It looks like somewhat extended version of my idea.
March 24th, 2009 at 19:23:51
this is really really cool man!… thanks for the idea.
November 17th, 2009 at 01:07:14
[…] took and made a DoomGuy version of autotest growl that completely rocks. The more specs that fail the worse your DOOM […]
November 19th, 2009 at 18:22: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. […]
May 23rd, 2010 at 19:05:21
[…] Unit Tests + Growl + Doomguy Posted on May 23, 2010 I read this post about setting up autotest with growl. The little doomguy was a nice effect and got a literal lol out of me (llol?). However, the post […]