When a bug appears in our code, the common approach is to quickly identify and fix the problem in the production code. Although this may resolve the issue, it poses a certain degree of risk. Merely modifying the production code does not guarantee that we have fully comprehended the problem, nor does it assure that the issue will not reoccur. To mitigate these risks, it is crucial to validate and verify the changes made to the production code. One effective solution is to create a test-harness and reproduce the bug using a test. This approach enables us to confirm that the issue has been resolved correctly and helps us prevent the problem from occurring in the future.
Have the participants discuss in small groups how they fix bugs. This often involves analysis, using the debugger and manual testing.
Explain the steps how to verifiably fix a bug in the way it stays fixed.
Practice the designing of test cases that reproduce a simple bug. For this we use the Bug-Hunter-Kata.
Ask the participants what they did and collectively review their code.
For the test code, ask the following questions: