Amer
Amer

Reputation: 2017

Does test-driven development consider a part of behavior-driven development?

More precisely does writing unit tests consider as BDD practice?

Does unite testing consider as a part of BDD/TDD or both?

Upvotes: 4

Views: 238

Answers (1)

Sergey Berezovskiy
Sergey Berezovskiy

Reputation: 236328

There are several types of tests: unit tests, acceptance tests, integration tests. And there are several development practices, like TDD or BDD. So, BDD is not only about acceptance testing. BDD can be done unit tests level. Here is some of Dan North thoughts about difference between BDD and TDD when we speak about unit-testing:

  • Test method names should be sentences (throw the 'Test' word away)
  • Focused on behavior sentence template (start test name with 'Should' or 'ShouldNot')
  • etc

There are different BDD frameworks for different types of tests. E.g. SpecFlow for acceptance BDD, or NSpec for unit level BDD.

So, answering your questions:

  • If unit tests done in BDD style, then writing those tests is BDD practice
  • Again, unit-testing could be part of BDD, if we are not talking about acceptance tests. Keep in mind, that unit-testing could be done separately from TDD/BDD, e.g. when you writing tests for existing code.

Upvotes: 4

Related Questions