SDWest: Behavior Driven Development

This morning I'm learning about Behavior Driven Development (BDD) from Dave Astels. At its core, BDD is just Test Driven Development (TDD) with different syntax.

TDD relies on unit testing frameworks, and everything you do references testing: Your tests execute within a TestCase. You Assert that conditions are/not true. You VerifyValue class member values. Everything conspires to make you very focused on the state of the object under test. This is one reason why wars often break out regarding whether private methods should be unit tested - private methods are part of the object's state, so from some points of view it makes just as much sense to unit test them as it does to unit test the public methods.

BDD changes the focus from testing state to specifying behavior. Your tests execute within a Context. You state that behavior should/not be true. The environment helps you focus on the behavior that should result from a specific context rather than the state that should hold in a specific case.

Like I said, pretty much just TDD with different syntax. Dave believes, however, that the different syntax induces a different frame of mind. I've only been doing BDD for two hours, but I would have to agree. The language you speak affects and to some extent restricts the thoughts you can think. This is true for spoken languages, it is true for programming languages, and this morning I'm learning that it's true for design languages as well.

One potential downside is that BDD's supporting framework rSpec is only available for Ruby. (Which, I'm learning, is a very fun language!) Dave says there are Java and .Net implementations in the works, however. Hopefully we won't have to wait too long!