TDD vs. BDD? Really?
Is there a difference between TDD and BDD? I don't really think so. I
have the debate occasionally and hear all about the goodness that is
BDD with
RSpec. RSpec is cool, ok, very English and all, but I can't
help but to ask myself what's the big deal? If I were to write a test
using JUnit I would write it like this:
public class AgileSoftwareDevelopmentTest extends TestCase {
public void testShouldBeEvolutionary() {
assertTrue(new AgileSoftwareDevelopment().isEvolutionary());
}
}
So there it is, a
test that ensures that Agile Software Development
is evolutionary, TDD style.
Ok, so on to the next example, one of the Ruby/RSpec variety.
describe "Agile Software Development" do
it "should be evolutionary" do
AgileSoftwareDevelopment.new.should be_evolutionary
end
end
I personally see little difference between the two...
Now, with RSpec you can generate the nice readable documentation which,
by the way, is totally sweet using the RSpec command
spec agile_spec.rb --format specdoc
Agile Software Development
- Should be evolutionary
Using a tool called
AgileDox I can get the same results, in fact, BDD
was
inspired by AgileDox and created by Dan North in order to eliminate
some of the confusion and learning curve involved with proper TDD.
Let's look at an AgileDox version of the JUnit test to see what we
would need to do to the test to be able to generate the RSpec style
documentation using AgileDox:
public class AgileSoftwareDevelopmentTest extends TestCase {
public void testShouldBeEvolutionary() {
assertTrue(new AgileSoftwareDevelopment().isEvolutionary());
}
}
See the difference? It's subtle... It's so subtle it's invisible, no changes required.
By simply removing the word test from the system, you get the same
effect.
I have no problems with using the term BDD, in fact I think it is
very beneficial to focus people on what's important in the test. It
unfortunately seems to me that whenever the two are brought up, they
are promoted as competitors in the same space, not as complementary
techniques. I guess I should get over it and tell people I do BDD
using JUnit...