A big part of my job is maintaining old code bases. Unfortunately, it’s rare that these code bases were written with testability in mind. As a result, I start with very little confidence in the changes I’m making: I’m not sure how the code works so I can’t safely say that my change are safe. In my opinion, the best way to gain confidence in a code base is to write automated tests for it. But usually easier said than done.
Here’s a problem I always have to deal with: I can write a bunch of automated tests for the legacy system but the tests will eventually access a database or call a remote API that is super slow. Before I know it, my tests take 10+ minutes to run. Once that happens, I run them less frequently because the wait is a pain, and when that happens, it takes me longer to notice if I’ve introduced a bug.