Behaviour Driven Development And rSpec

Last week, Dave Astels came into Halifax and gave a talk on Behaviour Driven Development (BDD) and rSpec (a BDD framework for Ruby). I thought it was quite the interesting talk, and that a lot of things seemed to make sense.

I took some rough notes, and thought I would write a bit about what I managed to take away from the talk.The premise behind BDD (as I understand it) is that many users are only getting part way up the Test Driven Development ladder and then getting stuck and not being able to leverage the full set of tools and techniques they have at their disposal. Some of this has to do with terminology (ala the Sapir-Whorf hypothesis) and not being able to grasp the concepts as they are presented. For example, TDD has unit tests, but what exactly is a unit? What exactly are tests supposed to test?

TDD emphasizes checking state at various points in execution. BDD, as the name would imply, defines tests in terms of behaviour.

The part of the talk that I enjoyed most was the fact that BDD focuses on human readability. So instead of something like:

def test_truth

assert_kind_of Group, @group


you get:

specify “is really a group” do

@group.should_be_an_instance_of Group


Note: the above examples are identical in functionality (in fact, Dave pointed out that they made a point to provide all the same functionality as the Ruby TDD framework, so people that preferred BDD would have a clear migration path) but differ in how they are presented.

If you are interested in a more in depth description, you can check out an earlier version of the talk on Google Video or check out Dave’s site

No comments yet. Be the first.

Leave a reply