Test-Driven Development (TDD) is one of the main technical practice of agile software development. In his blog post, Bradley Braithwaite shared the top five Test-Driven Development mistakes based on his own experience as a consultant. These mistakes lead organizations to abandon TDD because they think that there is no return on the time invested in Test-Driven Development or the code base become more difficult to maintain.
The top 5 TDD mistakes according to Bradley Braithwaite are:
1. Not using a mocking framework
2. Too much test setup
3. Asserting too many elements
4. Writing tests retrospectively
5. Testing too much code
These mistakes are explained in detail with code examples. His final advice is “only test what you need to”. Don’t create unit tests for property setters, getters and constructors but write a separate test for every iF, And, Or, Case, For and While condition within a method.