small-ish debate on BDD

November 18, 2008 at 6:17 am (ruby) (, , , )

Courtenay started it, stating that his team stopped using rSpec, saying

We wasted a day or two (three, maybe four developers) which equates to several thousand dollars in wasteage. It was also really infuriating — the culmination of a few years of frustration of rSpec’s weirdnesses.

They left rspec and used rr, context, and matchy instead. Many other favorite library proposed in the comments.

Josh Susser compared rSpec with shoulda and test/spec in his The Great Test Framework Dance Off.

David Chelimsky responded and stated that some of Josh’s criticism was true, but

What Josh didn’t know at the time, and this is definitely worthy of a ding for us not documenting things well enough, is rspec’s simple_matcher method that let’s you create simple matchers in just a few lines. Here’s the example in test/unit from Josh’s talk:

def assert_sorted(actual, message=nil, &block)
expected = actual.sort(&block)
assert_equal expected, actual, “Order is wrong:”
end
assert_sorted(tags) { |a,b| a.name b.name }

And here’s the same thing with simple_matcher:
def be_sorted
simple_matcher(“a sorted list”) {|actual| actual.sort == actual}
end
[1,2,3].should be_sorted

Dan Croak from Toughtbot fame spoke up also, criticizing another BDD tool, Shoulda, stating that, like rspec, it adds complexity to achieve virtually no result, comparing it to test/unit that is already included in Ruby core library, faster, and simpler.

Later, Pat Maddox refutes it, stating that sometimes a tool is not just a tool. That is, TDD / BDD does do something important. Making him keeping his responsibility

It is my responsibility to keep existing code working, to improve existing code to make it more maintainable, and to write new code that functions and is maintainable. The best way I’ve found to do this is to do TDD. It’s not the only way, of course, just like GTD isn’t the only system for managing your workload. But it’s proven to be pretty damn effective.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: