Test-Driven Development
Test-driven development is a methodology we embrace in order to increase productivity, reliability and maintainability of our code. The assumption is that writing tests first and then writing code afterwards will be much easier due to the fact that we already thought about the public interface and its expected input and output values. Thus, having done all that work upfront, the actual work inside is more straightforward to implement and it becomes trivial to validate the correct functionality of any implementation as you already have the expected output defined.
Obviously it also increases reliability, as any change must continue to meet the test cases defined. Thus we can assume that the behavior of code does not accidentally change in such a way that it becomes incorrect, even if somebody refactors it in the future.
Business benefits of TDD
- Deliver more value, and do it faster
- Always ship working software
- Adapt to change quickly
Code benefits of TDD
- Readable specs and code
- Clean public interfaces
- Decoupled modules
Process benefits of TDD
- Regression safety net
- Fearless refactoring
- Team trust