When a Bug is Found When a bug is found tests are created to guard against it coming back. A bug in production requires an acceptance test be written to guard against it. Creating an acceptance test first before debugging helps customers concisely define the problem and communicate that problem to the programmers.
Programmers have a failed test to focus their efforts and know when the problem is fixed.
Given a failed acceptance test, developers can create unit tests to show the defect from a more source code specific point of view. Failing unit tests give immediate feedback to the development effort when the bug has been repaired.