Mumble your tests!

I’ve been working on a rails project, and in some screen cast, I saw autotest+growl and fell in love. I googled a bit for a Linux version of growl, and I found Mumbles. There was no built in autotest support, so I hacked around, extended the Mumbles dbus interface just a little, and then made a simple autotest hook that uses Mumbles.
Until the author commits my patch to his repository, you can get my patched version as a tarball here: Mumbles patched (its a bziped tarball, not a jpeg file - wordpress limitations, so right-click and save as)
And here’s the autotest plugin:
require 'dbus'
def send_message(title, message, icon)
begin
bus = DBus::SessionBus.instance
mumbles_service = bus.service("org.mumblesproject.Mumbles"
mumbles = mumbles_service.object("/org/mumblesproject/Mumbles"
mumbles.introspect
mumbles_iface = mumbles["org.mumblesproject.Mumbles"]
sig = mumbles_iface.signals["Notify"]
bus.emit(mumbles_service, mumbles, mumbles_iface, sig, title, message, icon)
rescue Exception => e
end
end
Autotest.add_hook :ran_command do |at|
begin
output = at.results.last.slice(/(\d+) examples?, (\d+) failures?(, \d+ pending)?/)
if output =~ /.*[1-9] failure.*/ then
send_message("FAIL", "#{output}", "fail.png"
else
send_message("PASS", "#{output}", "pass.png"
end
rescue Exception => e
end
end
You’ll need the ruby-dbus library which you can get here
*Update:* surrounded the hook with begin rescue. Without this, autotest would crash if I had a syntax error in my spec, because at.result.last would be nil

I’d be cool if you posted a screenshot :)
Screenshots for Mac version using growl are on my blog here: http://szeryf.wordpress.com/2007/07/30/way-beyond-cool-autotest-growl-doomguy/
You can have growl-like notifications even simpler without mumbles using the builtin (?) libnotify and notify-send. I found a tutorial here (http://ph7spot.com/articles/getting_started_with_autotest) and it works very well.
Sorry I’ve been away for really long. The screenshot is up now, and Andreas, I know about libnotify, I was searching for something better looking
There have been some changes made to the Mumbles autotest plugin, and hopefully they’ll be in the SVN repository soon. Until then, this method still works.
Thanks! This is just I’m looking for!
[...] Looks like they use it to get notifications about automated tests. And then he found mumbles and re-worked his [...]
the code above, when cut-and-pasted, gives me tons of errors. encoding issue?
it worked for me like this:
require ‘dbus’
def send_message(title, message, icon)

begin
bus = DBus::SessionBus.instance
mumbles_service = bus.service(”org.mumblesproject.Mumbles" “
mumbles = mumbles_service.object(”/org/mumblesproject/Mumbles" “
mumbles.introspect
mumbles_iface = mumbles["org.mumblesproject.Mumbles"]
sig = mumbles_iface.signals["Notify"]
bus.emit(mumbles_service, mumbles, mumbles_iface, sig, title, message, icon)
rescue Exception => e
end
end
Autotest.add_hook :ran_command do |at|

begin
output = at.results.last.slice(/(\d+) examples?, (\d+) failures?(, \d+ pending)?/)
if output =~ /.*[1-9] failure.*/ then
send_message(”FAIL”, “#{output}”, “fail.png" “
else
send_message(”PASS”, “#{output}”, “pass.png" “
end
rescue Exception => e
end
end
mumbles has growl support, now, actually (version 0.4-1)
Yeah, mumbles has support for growl network notifications. Not sure how you would use that to get autotest notifications, since people mostly really on growlnotify in their autotest hook which of course won’t be available on linux
Just what I was looking for. Thanks for sharing!