Autotest notifications in KDE using DCOP and KNotify
Thursday, August 24th, 2006
I recently came across a killer ruby application called autotest, which is part of a package called Zentest.
Geoffrey Grosenbach’s Nuby on Rails blog explains how to use autotest with Rails. It’s pretty simple, install Zentest:
gem install ZenTest
and from the Rails project’s root, type:
autotest -rails
Monitoring a console for failed tests is annoying and keeping an open console on-screen is too screen real-estate expensive on a 14 inch laptop. Enter KNotify and DCOP.
Create a file called .autotest in your home directory and paste the following code into it:
1 2 3 4 5 6 7 8 9 10 | #!/usr/bin/ruby module KDENotify def self.knotify title, msg system "dcop knotify default notify " + "eventname \'#{title}\' \'#{msg}\' '' '' 16 2" end Autotest.add_hook :red do |at| knotify "Tests failed", "#{at.files_to_test.size} tests failed" end end |
Once autotest is started and coding has commenced, a passive pop-up window will appear as soon as a saved file has caused a test to fail.
This is all made possible by autotest’s excellent design along with the genius that is KDE.



