Tuesday, May 08, 2007

Acceptance Testing in Ruby

I'm teaching myself Ruby with the help of a 'toy' project. Sometime ago I wrote PerlActor, an Acceptance Testing framework that was inspired by Exoftware's Exactor open source project. I thought it would be educational and fun for me to port my Perl effort to Ruby. I've made good progress to date and I've learnt a lot about Ruby along the way. However, a question arises: Is an Exactor / PerlActor style testing framework useful for Ruby projects?

Exactor and PerlActor express tests in a simple language specific to the domain under test. They take an approach similar to FIT, but with test cases stored in simple text files, rather than embedded in HTML tables. By way of an example, a typical PerlActor test, in this case for a web application, might look like the following:


NewUserAgent
GoTo http://www.google.com/
PageTitleShouldContain Google


'GoTo','NewUserAgent' and 'PageTitleShouldContain' are commands, which are domain specific and either provided by the framework or implemented by the user of the framework. Exactor comes with a library of such commands. PerlActor is more basic, with the supplied commands really just being examples.

IMHO, a big selling point of this approach to testing is the customer-friendliness (in the Agile sense) of the tests. The test cases are very readable and it's possible for customers to write their own acceptance tests without needing to learn a complex syntax.

With Ruby's excellent support for meta programming, it may be possible to express such tests in Ruby code, while keeping the syntax as clean as the above. I'm not sure how to acheive this level of simplicity in Ruby and so I would be interested in hearing your opinions.

Friday, April 13, 2007

Ruby Ireland

Ruby is a fascinating language whose star is rising thanks to the buzz being generated by the Ruby on Rails web development framework. I've been itching to try Ruby on a real world project for quite some time, but alas the day job is stubbornly Perl-centric.

To get a much needed Ruby fix, I attended my first Ruby Ireland Group meeting last Tuesday at the Morrison Hotel in Dublin. The turnout was good with about a dozen folks in attendance. I thoroughly enjoyed the two presentations and the followup nosebag in the nearby La Taverna di Bacco.

Olivier Ansaldi gave us a whirlwind tour of Why The Luck Stiff's Camping web framework, which manages to be both very weird and very clever. David J Rice scared us with his plans for world domination using an army of Giant Robots controlled by Distributed Ruby (Drb) code.

The Ruby Ireland group plans to meet on the 2nd Tuesday of every month in the Morrison. If you have an interest in Ruby and related technologies then come along a take part in the fun.