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.