TDD vs. BDD? Really? 5
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 endI 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 evolutionaryUsing 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...
Comments
-
Good point. Remind me to show you what I am doing at work for generating executable documentation, it's in .NET though. ;-)
-
Nick, Is it called FitNesse? :)
-
Nope, it's something a little different.
-
Brandon, I am starting to use FitSharp for BDD. The main benefit I get is that analysts can set up edge case data and functions in the Fitnesse Wiki to extend my test platforms. This is pretty significant. TDD is developer driven - BDD is Business Analyst driven. Dennis Stevens
-
Dennis, We use Cucumber and FitNesse as part of our acceptance test toolboxes. I totally agree with your use case. I just don't really like the division of the two. To me it's kind of like the debate around whether or not Kanban is an Agile method or not. I'm not sure it is a productive conversation. Thanks! Brandon