I humbly request that discussion about testing in general be done in another thread. :wink:
Back to the topic:
As I see it, Test-driven development is basically "specification-driven development". The specifications are stated in the form of executable tests.
If you follow the rules, you're guaranteed that:
- 100% of the code is testable.
- The tests are already written, since they're written before the code.
- The testing can be done, more or less, at the push of a button.
- There's no unnecessary code or unused code. Only the minimum code needed to pass the tests is there.
A big benefit is that regression errors can't happen. If you need to change the code later, you first write a test that requires the code change, then make the code change that successfully passes the test (and all the other tests).