- find the bug
- write a test to show the bug
- write the code to fix the bug
I’d made some changes to a client project and while I wasnt specifically fixing a bug I did alter a behaviour that resulted in one.
Turns out I didnt have a test already in place to reveal this change and that cost me a couple hours to track down, write the test, and fix the bug I’d caused.
Having a huge test suite built in (there are nearly 1500 unit tests for this code at present) has helped make sure that changes dont cause bugs.
And the new ones will make sure they dont reappear
Test early. Test often
Stay sane !