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.
4 comments:
I agree with your comments on the value of the exactor approach. Check out http://blog.peelmeagrape.net/2007/5/8/exactor-style-at-in-ruby-spike for a quick spike of implementing exactor in ruby.
Thanks for the spike, Darragh. Your code is elegant and educational and it has given me some pointers for cleaning up the internals of my own code.
I created something similar a while back but dont have the code to hand at the moment. I chose not to go down the route of using hpricot or any of those other plugins and extracted what was required by first converting everything to RXML and then using XPATH to pick out the elements.
CG, the Exactor approach has wider applicability than just testing web applications. Darragh's spike used hpricot because my example was a test one might use in a web application. However, Exactor commands can wrap or drive anything so long as you have access to an API.
Post a Comment