Test behaviour, not implementation In my experience, the biggest hurdle to changing existing code has been burden of fixing or re-writing a ton of broken tests. It drives me nuts when I change the implementation of a function or class while retaining the same behaviour and a bunch of unit tests break. This is often caused by unit tests that are too low level. Find the right altitude for tests while being able to provide good coverage, execute quickly and remain stable. A good test suite should encourage refactoring, not hinder it.
Great Software Isn’t Built To Last, It’s Built To Die Gracefully
Zach Mathew
1805

I feel so bad for the developers maintaining some of the code I wrote because of the tests I wrote for them. Many apologies.