How do TDD, BDD and ATDD differ, and how are they related?
Answer
TDD drives code in short test-code-refactor cycles, usually with developer-facing component tests. ATDD derives acceptance examples collaboratively before implementation. BDD uses examples and shared domain language, often in Given/When/Then form, to describe behavior. All are test-first approaches, but their audience, scope and primary design conversation differ.
Strong answer includes
- distinguishes code design from acceptance design
- explains BDD as collaboration and examples
- recognizes all three as test-first approaches
Practical example
A developer practicing TDD writes a failing unit test for a discount-calculation function, implements just enough code to pass it, then refactors — repeated dozens of times a day, invisible to anyone outside the team. Before that, the whole team — PO, dev and tester — sat down in a three-amigos session and wrote an ATDD example: 'given a cart of 100 dollars and a 10-percent coupon, the total should be 90 dollars.' That same example gets expressed as a BDD scenario in Gherkin and becomes an automated acceptance test that also serves as living documentation for stakeholders.