Continuous Integration Goodness(TM) for Your Ruby Project
Posted by Nick Sieger Sat, 06 Jan 2007 15:42:00 GMT
As much as we’d like to think we live in a Ruby-glasses-colored world, the fact is there are plenty of neat toys out there that don’t know a bit about us. One that I’m currently enamoured with is Bamboo, Atlassian’s new continuous integration server. But, most commercial CI products are aiming for a wider market, and that means Java and Ant. Ant and JUnit predate Rake and Test::Unit by a few years, so I’m afraid they beat us to the punch, so that now the JUnit Ant task’s XML format is pretty much the first consideration for a continuous integration server to understand in order to display a test report for a build.
Where does that leave us Rubyists who want to play along with the bigs? Right here!. With support for not just RSpec, but Test::Unit too.
Right now, it’s packaged as a Rails plugin, because I’m lazy and I don’t need anything else right now. If you’re interested in a gem, please leave a comment. To install into your Rails app, the usual:
./script/plugin install http://svn.caldersphere.net/svn/main/ci_reporter
That’s it! Now all you have to do is have your CI server invoke an extra target before the main target that runs your tests.
For RSpec,
rake ci:setup_rspec spec
will leave one XML file per context in the spec/reports
directory (creating it if it doesn’t exist).
For Test::Unit,
rake ci:setup_testunit test
will leave one XML file per test case class in the test/reports
directory.
Most CI servers have configuration telling them where to look for test reports. Simply plug in one of these directories, and you’re set. Now sit back and watch your test or spec failures get tracked in your automated builds.