Home · Blog · Talks · Projects

RSpec adding to the confusion?

Update:

I’ve just read Aslak’s article again in the cold light of day. I now realise I have put words in his mouth, for which I apologise.

I posted the article late at night after being annoyed by the line on the caboose blog. In hindsight, I should have waited until morning and read it through again (and then not posted it in it’s current form).

Original Article:

In a recent article Aslak Hellesoy seemed to imply one of the differences between RSpec and Test::Unit was that RSpec you could do interaction-based testing using Mock Objects. I don’t think this implication was intentional, but this lack of clarity isn’t helpful to those just getting to grips with automated testing.

As I’m sure Aslak will acknowledge, interaction-based testing has been around a lot longer than RSpec and BDD. Most Ruby mocking frameworks (e.g. FlexMock, Mocha) were originally designed to work with Test::Unit. And as Nat Pryce recently explained ,“Mock Objects is a Technique Not a Technology”.

There is a similarly confusing statement in a recent post from courtenay (of the caboose).

The counter-intuitive thing for you test::unit types is that you set up the expectations before calling the method.

…thus perpetuating the myth that you can’t do interaction-based testing without RSpec.

Today, Martin Fowler published an update to his excellent article “Mocks Aren’t Stubs”. I think he has added clarity by breaking

the old dichotomy of state based testing and interaction based testing into the state/behavior verification dichotomy and the classical/mockist TDD dichotomy.

However, I fear people might incorrectly associate “behavior verification” with BDD.

In a comment on Aslak’s article, David Chelimsky comments that

It helps at the very least by promoting this very conversation. How does it hurt?

I don’t think it hurts to have a debate (about whether BDD is more usefu than TDD), but we should avoid sowing confusion about what makes BDD different from TDD.

Aslak talks about the “BDD buzzword”. Quoting from Wikipedia

Buzzwords are typically intended to impress one’s audience with the pretense of knowledge. For this reason, they are often universal. They typically make sentences difficult to dispute, on account of their cloudy meaning.

I vote for more clarity and less cloudy meaning.

Contact · History · Colophon · Links