Tuesday, December 27, 2005

More Behaviour Driven Design - Victor Cosby and Stacy Curl's work

I have just found out Victor Cosby's Dreaming of Electric Sheep where he gives examples of Dave Astel's Behaviour Driven Design ruby framework (rSpec), providing some examples. The rSpec framework goes for the junit-like approach where every class has an associated 'test' class (Spec here). This offers some advantages over the approach that I used in Intent. For example you can introspect the Spec classes to gather some information on the name and number of specs that you are going to check.

I adopt a more free-flowing incremental kind of style, but many of my 'test' information are built only while the checks are executed.

I have also seen some work done by Stacy Curl on a unit test framework that uses PicoUnit to define tests in a pretty clean way.

There are quite a few things that I like about Stacy's work. For a start, while all the action happens within the context of tests, the code is shaped in such a way that it clearly expresses intentionality by using a reader-oriented declarative style. I also like Stacy's approach to Test evolution. You can see how the test evolves becoming richer and richer via intermediate steps that still make sense.

Finally Stacy also starts reasoning about tests in terms of an 'imaginary language'. I find this to be very forward thinking, as our basis for shaping knowledge should be based in language rather than specific programming languages. This allows us to push the boundaries of our programming languages to handle more complex situations that could be easily described in human-oriented languages.

While I use dependency injection, I don't use mocks the way Stacy does and this is probably the main difference with my work on intents. I don't usually care about the interaction of my objects with other objects and I only care for direct results. His mocks seem to check for the behaviour of side effects and this doesn't fit in my intent model well.. well, it's food for thought and it might open new perspectives for me.

Comments:
Correction here.

Actually rSpec is Dave Astel's work, not mine. I was simply posting about rSpec. The code you see in that post is just an implementation of some toy classes to pass the tests he wrote in his article so I could try out rSpec. So please change your post to give appropriate credit to Dave. Thanks.

Cheers.
 
Victor, thanks for finding the time to point this out. I made the correction. Looking back at your post I have no idea how I could get it wrong.
 
Actually, I just did a little more research and I need to correct my correction. ;)

While Dave has made contributions to RSpec, Steven Baker got the ball rolling, along with Aslak Hellesoy and Gabriel Baumann, and Steven's made some recent additions that look really promising if you check out his blog. You can now get the svn trunkfrom rubyforge:

svn checkout svn://rubyforge.org//var/svn/rspec

He may have added a runner now as he alludes to it in his port of RSpec to Io (IoSpec).
 
Oh, and one last plug for Steven. He's giving a workshop on Rails at Canada On Rails this April where it looks like he will be talking about BDD and RSpec. Very tempting.
 
Just checking out Steven's stuff. Let's see if I can steal any idea for my Intent framework :-)
 
Thanks Victor, there are lots of similarity between my work and the latest RSpec done by Steve. I'll certainly check it out better.
 
Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?