What I Learned After Writing 300 Tests While Refactoring Legacy Code
A five-year-old service had zero tests. At first I wanted to "start with the architecture," but my boss asked just one question: "If that breaks, who's going to know?"
In the end, I started by writing characterization tests. Their purpose is to lock in existing behavior as-is, so you don't need to make the code pretty. Once I had around 300, from then on I could confidently tear things apart and rework them.
If I'd done this in the opposite order, I probably would've given up and rolled back within three days.
by 디지털노마드596