TDD vs BDD - alexanderteplov/computer-science GitHub Wiki

Test Driven Development vs Behavior Driven Development

Test-driven development cycle

  1. Add a test
  2. Run all tests. The new test should fail.
  3. Write the simplest code that passes the new test. Inelegant or hard code is acceptable, as long as it passes the test.
  4. All tests should now pass. If any fail, the new code must be revised until they pass.
  5. Refactor as needed, using tests after each refactoring to ensure that functionality is preserved.

Repeat

Some limitations of TDD

Test-driven development does not perform sufficient testing in situations where full functional tests are required to determine success or failure, due to extensive use of unit tests. Examples of these are user interfaces, programs that work with databases, and some that depend on specific network configurations.

With unstable requirements (insufficient analytics) may become drastically inefficient due to repeating overriding.

The difference

  • TDD is for unit testing. BDD is mostly for integration and e2e testing.
  • TDD implements in the codebase. BDD implements in pseudocode understandable for all the participants.
  • In TDD test ara written by developers. In BDD several team roles could be evolved: QA engineers, business analysts, developers, etc.
  • TDD asserts modules functioning, BDD asserts user scenarios.

Links

⚠️ **GitHub.com Fallback** ⚠️