This great video of David Farley discusses the benefits and challenges of automated testing, and compares two approaches: test-driven development (TDD) and behavior-driven development (BDD). It argues that BDD is a more effective starting point for improving automated testing in most cases, and explains how to implement it using a domain-specific language and a four-layer approach.
Highlights:
The problem of automated testing
Most people prefer software with good automated tests
Manual testing is slow, expensive, and unpredictable
The question is how to automate testing effectively
The value of test-driven development
TDD gives fast and clear feedback on the design of the system
TDD produces lots of decoupled (if there are correctly written) tests that can run frequently
TDD is a valuable tool for individual developers
The difficulty of test-driven development
TDD is hard to retrofit to existing code that is not well designed
TDD requires refactoring skills and discipline
TDD is easier to adopt for new code than for old code
The alternative of behavior-driven development
BDD is easier to retrofit to existing code of any technology
BDD focuses on what the system does, not how it does it
BDD involves creating a domain-specific language (DSL) to script scenarios
The process of behavior-driven development
Start by learning how to determine the releasability of the system
Use acceptance test driven development to build the DSL
Start with a simple scenario and grow the DSL as needed
Use the four-layer approach to separate concerns and avoid coupling
The benefits of behavior-driven development
BDD can replace manual testing with automated tests quickly
BDD can run the tests all the time and give faster feedback
BDD can increase the determinism and control of the system
Martin Fowler - TDD: https://martinfowler.com/bliki/TestDrivenDevelopment.html
Robert C. Martin - Cycles of TDD: http://blog.cleancoder.com/uncle-bob/2014/12/17/TheCyclesOfTDD.html
Robert C. Martin - ¿Por qué hacer TDD?: https://www.youtube.com/watch?v=GvAzrC6-spQ