Differences in TDD and BDD

I honestly don't see the difference between BDD and TDD. I mean, both are just tests if the expected happens. I have seen BDD tests that are so focused that they are almost considered TDD tests, and I have seen TDD tests that are so vague that they have a black box of a lot of code. Let me just say that I'm sure both are better.

Here is a funny question. Where to begin? Am I starting with high level BDD tests? Am I starting with low level TDD tests?

+42
tdd testing bdd
Dec 09 '10 at 6:24
source share
9 answers

I honestly don't see the difference between BDD and TDD.

This is because it is not there.

I mean, both are just checks, if expected, expected.

It is not right. BDD and TDD have absolutely nothing to do with testing. Nobody. Nada. Shish. Zip. Knicks. Not in the least.

Unfortunately, TDD has the word “test” in almost everything (not only in its name, but also in the test environment, unit test, TestCase (the class you inherit from), FooTest (the class that usually runs your tests), testBar (a typical naming pattern for the test method), plus many terminological terms such as “statement” and “test”), which leads some people to believe that this is actually something in common with the tests. So, some smart people said, “Hey, let me just change the name” to eliminate any confusion.

And what is BDD. It is simply a TDD with any terminology terminology replaced by terminology related to behavior:

  • Test → Example
  • Approval → Expectation
  • assertshould
  • Unit → Behavior
  • Verification → Specification
  • & hellip; etc.

BDDs are simply TDDs with different words. If you do TDD correctly, you do BDD. The difference is that - if you believe, at least, in the weak form of the Sapir-Whorf hypothesis - different words allow you to do it right.

+56
Dec 09 '10 at 10:02
source share

BDD has a customer perspective and focuses on verifying the behavior of the entire system.

TDD has a developers point of view and focuses on the implementation of a single element / class / function. He wins among others due to the best architecture (design for testing, lack of communication between modules).

From a technical point of view (how to write a "test") they are similar.

I would (from a moving point of view ) start with one bdd-userstory and implement it using TDD.

+24
Dec 09 '10 at 8:11
source share

From what I have compiled on Wikipedia, BDD includes a QA test and test that cannot be performed without the participation of interested parties / users. In addition, BDD uses a natural language to indicate its test, while TDD usually uses a programming language. There may be some coincidence between them, but I think that this is not a nebula, but the BDD language, which is the main difference.

As for where you should start, which really depends on your development process, right? I assume that if you do from the bottom up that you are going to write TDD first, and as soon as you reach a higher level, you will use BDD to check if these functions work as expected.

As noted in k3b: the main difference is that BDD is problem-oriented, while TDD is a more oriented solution area.

+4
Dec 09 '10 at 8:09
source share

Just by copying the answer from Matthew Flynn , which I agree more than "TDD and BDD have nothing to do with tests":

Behavior-driven development is an extension / revision of Test Driven Development. Its purpose is to help system developers (e.g. developers) determine the appropriate tests for writing, i.e. Tests that reflect the behavior desired by stakeholders. The effect ends the same way - to develop a test, and then develop a code / system that passes the test. The hope in BDD is that the tests are really useful, showing that the system meets the requirements.

UPDATE

Code units (individual methods) may be too granular to represent the behavior represented by behavioral tests, but you should still test them with unit tests to ensure they work properly. If this is what you mean by "TDD" tests, then yes, you still need them.

+3
Jul 20 '15 at 19:53
source share

A fantastic article on the differences between TDD and BDD:

http://www.lostechies.com/blogs/sean_chambers/archive/2008/12/07/starting-with-bdd-vs-starting-with-tdd.aspx

It should provide you with everything you need to know, including problems with both and examples.

+2
Dec 09 '10 at 10:27
source share

BDD is about to get TDD eligibility. It provides “structure and dicycline” for your TDD. This will help you verify the correctness and make the right amount of test. Here is a fantastic little post on BDD and TDD,

http://codingcraft.wordpress.com/2011/11/12/bdd-get-your-tdd-right/

+2
Nov 12 '11 at
source share

The terminology is different, but in my work I use TDD to drill down on dev, mainly for unit test, and BDD is at a higher level, for client, QA or non-technical person.

0
Oct 23 2018-11-11T00:
source share

The main difference is only the wording. BDD uses a more detailed style so that it can be read almost like a sentence.

0
Aug 26 '14 at 8:00 a.m.
source share

I think that BDD's biggest contribution to TDD or any other approach makes non-technical people (product / customer owners) part of the software development process at all levels.

Writing executable scripts in natural languages ​​almost bridged the gap between demand and delivery.

Product owners themselves can run the scripts that he wrote and test using different data sets if he wants to play around code behavior written by a development team.

It's amazing! The client sits right in the center and definitely does not just ask what he really wants, but also checks and tests the results.

0
May 09 '17 at 1:28 pm
source share



All Articles