|
|
|
|
|
by rectang
1534 days ago
|
|
Unit tests which can survive a refactor are a nice-to-have. I would not rule out a refactor merely because I'd have to refactor some unit tests too. That's just part of the cost benefit analysis. > Rewriting tests during refactoring doesn't protect from regression on my experience. Your experience is completely at odds with mine. Every time I change code, there is the possibility for simple errors such as copy/paste mistakes. Trivial, cheap-to-write unit tests have saved me time and again from having to debug something down the line. Overconfident devs who act as though they're above making such simple mistakes make for bad team members. |
|
Tests that will survive a refactor are the most important tests to have.
The other tests are, at best, a false sense of security and often an active detriment that slows down future development. They might sometimes catch actual mistakes, but just as often they fail when nothing is broken, leading to the tests not being trusted and broken tests being updated even when something was actually broken.