File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Agile and Other Processes and the fly likes Clean Code: TDD and BDD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Clean Code: TDD and BDD" Watch "Clean Code: TDD and BDD" New topic
Author

Clean Code: TDD and BDD

Tomasz Prus
Ranch Hand

Joined: May 20, 2008
Posts: 73
Hi,

what are differences between tdd and bdd, does book cover these topics?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Its seems it discusses, some test practices like test first and test last. Not sure if it touches on BDD.

And as I said earlier, there is no 'differentiate' kind of thing between BDD and TDD. These are two different ideas, discuss two different things and can work together.

Cheers.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Adeel Ansari:

And as I said earlier, there is no 'differentiate' kind of thing between BDD and TDD. These are two different ideas, discuss two different things and can work together.


Mhh, my perspective is quite different. To me it looks like BDD is TDD with a different focus - more like an extensions to TDD than something totally orthogonal. I wouldn't even know what it would mean to do BDD without doing TDD. Haven't really thought about it, though. What would it mean?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
I wouldn't even know what it would mean to do BDD without doing TDD.


I can see what you mean here.
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
Originally posted by Ilja Preuss:
What would it mean?


I believe they're quiet different. While TDD insists that you write your test cases and testing code before you write your actual application, BDD is more flexible with that. You can write your whole application without writing a single line of code in your unit tests (and that is totally wrong). With BDD you analyze the requirements, get out of it with use cases and a design, and implement the logic, with or without unit testing, and if it's with unit testing (which should be the case), unit tests can be written after you finish your coding, or in parallel with it, while in TDD, you write your tests first.


Visit my blog: http://jnassef.blogspot.com/
Robert Martin
Author
Ranch Hand

Joined: Jul 02, 2003
Posts: 76
Originally posted by Tomasz Prus:
Hi,

what are differences between tdd and bdd, does book cover these topics?


The book does talk about TDD, but not about the differences between TDD and BDD.

The primary difference is one of level. BDD is still about writing tests first. The difference is that the "tests" are written in a form that makes them look much more like specifications, than code. The ultimate goal of BDD is to find a format that could simultaneously be used for both users stories and acceptance/unit tests.

So, for example, in rspec one might say:

describe BowlingGame do
it "should have zero score after twenty gutter balls" do
g = Game.new
20.times {g.roll(0)}
g.score.should == 0
end
end

This is ruby code, and looks like ruby code, but has a "flavor" of something that a non-programmer might just be able to read.

At a higher level in the rspec story runner you might say:

Given a bowling game
When 0 has been rolled 20 times
Then the score should be 0;

There is an interpreter that (given the appropriate patterns) can parse the above and execute the appropriate tests.

So, in the end, this is still TDD; but the phraseology of the tests is different. And as we all know, the language you use to express your thoughts can cause you to think differently about those thoughts.


---<br />Uncle Bob.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clean Code: TDD and BDD