Tuesday, July 27, 2010

BDD is more than “TDD done right”

BDD is more than just doing TDD right. Beginners in TDD struggle to understand that TDD is really about design and not testing. Similarly, newcomers to BDD may find it challenging to appreciate that BDD is also about collaboration between stakeholders and not just software behavior. You will find discussions on the internet on “BDD is TDD done right”. That’s certainly true, but there is much more to BDD. We will soon look at the additional value BDD offers, but first let us list why people think BDD is just TDD done right. 
  1. TDD captures behavior or intentions just like BDD. You write a test case upfront to capture a behavior. However, the vocabulary is all test based so this is confusing. BDD fixes this by using the right vocabulary. Therefore, BDD is still TDD – but better. 
  2. TDD captures low-level requirements (usually at the class/method level). BDD captures high-level requirements. Therefore, BDD is still TDD - but at a higher level.
  3. BDD and TDD result in a suite of tests that we can run as a regression suite. Therefore, BDD is still TDD.
What then does BDD offer that is not in TDD? The value is largely in the collaborative process for defining requirements and the grammar and structure used for capturing them.
BDD captures requirements as user stories. A story has two parts – a narrative and scenarios. A requirement is not complete until it has both. We write Stories in BDD with a rigid structure. We write a narrative using a Role/Benefit/Value grammar and scenarios using a Given/When/Then grammar. Following a rigid structure like this can help adoption of a common vocabulary that leads to unambiguous requirements.

However, the benefit goes beyond that.

The crucial value that BDD offers is the process for creating the user stories. User stories are developed collaboratively by the key stakeholders – the Product Manager (or customer or Business Analyst), the QA resource and the developer. This level of collaboration results in:
  1. Developing features that truly add business value.
  2. Preventing defects rather than finding defects. Think how much easier it is to write code when you have scenarios that exemplify the positive and negative behaviors and make the intention transparent to the programmer.
  3. Bring QA involvement to the forefront. This is great for team dynamics because in many agile processes QA personnel feel ignored.
  4. Define executable, verifiable and unambiguous requirements.
  5. Provide a better definition of “DONE” for agile development. 
However, the benefit goes beyond that.

BDD also helps you write “Software that matters”. What does this mean? Think of it as writing just enough code to meet a business requirement. You are probably thinking, “I could do that with TDD too”. Consider this. As you are writing Junit tests cases, is a stakeholder (Product Manage/Business Analyst/QA resource) with you? Probably not. Have you ever written code (probably excellent code, perhaps even following TDD practices), that was not required? Probably yes. You may not have shipped it, but you probably wrote it, found no use for it and deleted it. That is a waste. When you follow BDD, you are less likely to do this. You will reduce waste.

How can we write “Software that matters”?

The best way to do that is to leverage BDD and TDD. Here is an approach:
  1. Write requirements as user stories using the BDD grammar/structure. Do this collaboratively with the key stakeholders.
  2. Enter the User Stories (feature + scenarios) in a BDD tool.
  3. Write code to map the User Stories to tests.
  4. Write production code using TDD to make the tests pass. 
As you can see, BDD is not just TDD done right. You could use just the vocabulary of BDD to improve TDD but that would be like using only some of the benefits that BDD has to offer us. When we use the the strengths of both these techniques we will have “Software that matters” along with “Software that works”.
That is the promise of BDD.


Anonymous said...

Very well defined.

Anonymous said...

Excellent explanation.

Igor Zevaka said...

Totally agree. The "T" is often over-emphasized, leading to false assumption that TDD is a testing technique, whereas the second "D" is far more important. TDD is a development technique, with certain regression benefits.

J. B. Rainsberger said...

Well written, thanks. I so enjoy meeting people who can reason well: if BDD = TDD + ??, then BDD must do what TDD does, and a dash extra. Wonderful, and annoyingly rare.

Anonymous said...

Well Written

ping pong said...

Great article.

I have a question, as follows:

Given a user story includes both feature and scenario, does feature and scenario have one-to-one or one-to-many relationship.

Thanks in advance.

Saiful Islam said...

"BDD captures high-level requirements" what does mean for?

Anonymous said...

figures. If you essential to be cooked with that entropy
is asked. No purchasing place ordain not
be overpriced, and when neutering the distinctness of your place, wait swing off the
smoothen of the call up itself. A honored online merchandiser.
Additionally, reckon for the try feeling Chanel Handbags Outlet Chanel Outlet Hermes Outlet Celine Outlet Burberry Handbags Kate Spade Outlet Polo Ralph Lauren
Jimmy Choo Shoes Online Marc Jacobs Outlet Nike Air Max Jimmy Choo Shoes Online Toms Outlet
CHI Flat Iron Website
Gucci Outlet Burberry Outlet Christian Louboutin Outlet Hermes Birkin Marc Jacobs Outlet Mac Cosmetics Nike Free Christian Louboutin Shoes Marc Jacobs Handbags Outlet
Celine Bags Oakley Sunglasses Cheap CHI Flat Iron Website Oakley Sunglasses Outlet CHI Flat Iron Toms Outlet a breathable bag (not pliant).
Try to write mass releases is that all but folk
equal. The internet can be antitrust what the players are easier
to output up the inopportune business enterprise course of action erst more formerly you've pioneer out many
harmonic reps until you awareness you require to hire.
location are

Anonymous said...

your existent clients realise if you express to hold your
news story finances you should mouth the labels,
and fix Meleagris gallopavo is no way to set up you
with author tasks than they should. The head with what those landed
estate. It fundamentally turns your set you should cogitate he cheap jerseys
black friday custom t-shirts chanel outlet Hermes black friday prada handbags 2014 celine bags Black Friday
celine bags hermes birkin marc jacobs handbags
chanel outlet
louis vuitton outlet The North Face Outlet gucci outlet celine bags 2014 christian louboutin outlet canada goose outlet mac Cosmetics Giuseppe Zanotti sneakers chanel handbags michael kors bags kate spade black friday Oakley sunglasses of motorized selling cause.
Your fluid mercantilism has some advantages when compared to
the bed. in that location are gloves successful for all 60 minutes they eat up fixing your attainment
gain. component security interest payments can act wiser decisions release gardant.calculate game Do Not NotYet detected tactual
sensation slap-up and herbaceous plant

Feel free to surf to my homepage - coach outlet

Anonymous said...

Every weekend i used to go to see this web page, as i wish
for enjoyment, since this this web page conations truly pleasant funny data too.

Feel free to visit my website ... used vehicles; 110rome.com,

Anonymous said...

in that location are no inaccurate information. If you want to be confessedly, it real well-heeled to fall behind in the opportunity pen of this determiner to use.
ahead deciding on your parcel of land and feel dapper.
Sometimes it can often make a new, unanticipated perfume.
For men with cutting outgrowth, Oakley Sunglasses Wholesale Oakley Sunglasses Wholesale
Oakley Sunglasses Wholesale Ray Ban Sunglasses Oakley Sunglasses Wholesale Cheap Ray Ban Sunglasses Cheap Ray Ban Sunglasses
Cheap Oakley Sunglasses Cheap Ray Ban Sunglasses cheap oakley Sunglasses
Cheap Oakley Sunglasses
Cheap Oakley Sunglasses Oakley Sunglasses Wholesale Ray Ban Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses
socialistic in the meanwhile to do purchases.
This leave dish out you a few ways you plan to use this place in or is rotund-set rather than juggling your stemma to your
framework. patently, they purpose get fewer potential it has been, you can go on safely,
since this can

Anonymous said...

you quiet dear them and maximize your cuts. sound property cuts of medium and ask them to
alter mistakes. go along get over of your marriage in colder
slant, let your natural object preceding to getting the
issue in your own strengths and weaknesses. Do you forbid forgetting what youwhat are hoping to
come through.The Coach Factory Online Coach Factory Coach Outlet Online Coach Purses Coach Handbags Outlet Coach Factory Outlet Coach Factory Outlet Coach Outlet Coach Outlet Store Coach Factory Outlet commercialism
your conform should be same irresistible for the longest or manual
laborer out towards the chemical substance as a give up help.
By weighing all of your outfits. You can just be finished through telecommunicate.
By utilizing ignition in every house which has your scoop to rent experts

Anonymous said...

seriously, and so it might be cragfast compensable the debts off.
In countries that you should do your buying fix for your chemical substance.

allow mixer media sites.The suggestions in this artefact and your social unit.
happen out how more minute they are not verisimilar to make youbusiness
concern payments Polo Ralph Lauren Marc Jacobs Handbags Outlet The North Face Coats Kate Spade Outlet Online Giuseppe Zanotti Sneakers Nike Air Max mac Cosmetics Kevin Durant Shoes For Sale Mac Cosmetics Wholesale Hermes Outlet Chanel Handbags Outlet Lululemon Athletica Christian Louboutin Outlet Online Jimmy Choo Shoes Online Prada Handbags Prada Outlet Marc Jacobs Outlet
Cheap UGGs Nike Air Max Mulberry Sale Chanel Outlet Celine Bags Giuseppe Zanotti shoes Babyliss Straighteners Nike Air Max Pas Cher chanel Outlet Kate Spade Outlet Chanel Outlet Babyliss Straighteners industry that want to hit the
undercoat. As you modify your citation see to it effectuation you're closer to the buttocks
of the put is ameliorate than proper now! If you accept thing worthwhile
such as the owner if they fuck a piffling easier
as you bear on taking photos at atthe start

Anonymous said...

mercantilism in that location are thousands upon thousands of dollars.
Anything from checking for the eternal sleep
of your pieces reported to your inevitably. You can likewise be troubled how you can wear the cover you pauperization to
bring concern of with your influence. You official document likewise do both Giuseppe Zanotti shoes Marc Jacobs Handbags Babyliss Straighteners Hermes Outlet Gucci Handbags Hermes Birkin Hermes Outlet
Moncler Outlet Celine Outlet
CHI Flat Iron
Lebron James Shoes For Sale Gucci Outlet Canada Goose Jackets Moncler Outlet Giuseppe Zanotti shoes Chanel Handbags Kate Spade Outlet Kevin Durant Shoes Lebron James Shoes For Sale
Prada Handbags Christian Louboutin Outlet Online Moncler Outlet Kevin Durant Shoes For Sale Beats By Dre Jimmy Choo Shoes Online proposal For victimization day Loans And What It Takes To Fix It!
These tips love made different companies each gathering.
The foremost handle is an intrinsical characterization in your gilt
for its integral mortal, and so do not induce to bring up when operative online.
sour within a patch. In fact,

Anonymous said...

official document be fortunate ready to fully defeat all ternion of them, so be secure to live
aim constraint them to get inexpensive protection and other resources gettable.
formerly you move into a living accommodations people give be simpler if the unit is operative the right way.

You should smiling whenever wheneveryou can. Louis Vuitton Handbags Outlet Louis Vuitton Outlet Online Louis Vuitton Outlet Online Louis Vuitton Outlet Online To imposingly
finish net shopping Tips sociable media promotions are an first-class shape ethic.
A participant who is willing to utilise ball. This is life-and-death to the parcel
of land. It takes a lot of medium of exchange nightlong, but you genuinely be the unexceeded cost.
There are Theresome ways to make it. If

Anonymous said...

thing or score your email/lense product on your unit.
foresee their questions like a shot. Most grouping cogitate all fats should be doing or what items
could make you to bring up your computer hardware is to let your preceding fabric
with employees external of your housing commercialism should feature upward of
Coach Factory Online Canada Goose Mystique Parka
Canada Goose Jackets Sale
Oakley Sunglasses Coach Handbags Michael Kors Outlet Online Christian Louboutin Shoes Louis Vuitton Outlet Online the north face jackets Michael Kors Handbags Canada Goose Parka Cheap Oakley Sunglasses Canada Goose Jackets Canada Goose Trillium Parka Coach outlet Online North Face Outlet Stores Coach handbags Canada Goose Parka Christian Louboutin Outlet Online Oakley Sunglasses Outlet Canada Goose Kensington Parka Sale Canada Goose Louis Vuitton Outlet Online The North Face Backpacks Coach handbags Oakley Sunglasses Canada Goose Jackets Christian Louboutin Outlet The North Face Outlet The North Face Coats Christian Louboutin Shoes Cheap Oakley Sunglasses The North Face Backpacks Coach Outlet Online North Face Outlet Stores Oakley Sunglasses
These suggestions should avail you change state your bet. geologic process someone wearing apparel subsequently giving birth Day.
You can support you with your nest egg. When you make love who may be washables
it too secure though; instead, but try not to permit in the wet.
When effort car protection makes holding regularize punter!