Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Clean Code: TDD and BDD

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

what are differences between tdd and bdd, does book cover these topics?
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I wouldn't even know what it would mean to do BDD without doing TDD.



I can see what you mean here.
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Author
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!