Thorough sets of automated units tests serve as a kind of net for detecting bugs. They nail down, precisely and deterministically, the current behavior of the system. Good Test-First teams find that they get substantially fewer defects throughout the system life cycle, and spend much less time debugging. Well-written unit tests also serve as excellent design documentation that is always, by definition, in synch with the production code. A somewhat unexpected benefit: many programmers report that “the little green bar” that shows that all tests are running clean becomes addictive. Once you are accustomed to these small, frequent little hits of positive feedback about your code’s health, it’s really hard to give that up. Finally, if your code’s behavior is nailed down with lots of good unit tests, its much safer for you to refactor the code. If a refactoring (or a performance tweak, or any other change) introduces a bug, your tests alert you quickly.