by ithkuil · 2y ago · 0 comments
But a codebase with good test coverage allows you to safely perform large scale refactorings without having regressions and that's useful property even if you have bugs and the refactoring preserves them faithfully.
The risk of using a tool that generates tests designed to encode the current behaviour is that you may be lulled in a false sense of safety, while all you've done is to encode the current behaviour, as advertised.
Perhaps this problem can be just solved by not calling these tests "tests" but something like "behavioural snapshots" or something like that (cannot think of a better name, but the idea is to capture the idea that they were not meant to encode necessarily the correct behaviour but just the current behaviour)
aka snapshot tests.
Code coverage metrics are most easily met by writing unit tests. Unit tests are tedious to write.
If you have a robot writing unit tests, I do not want to see your codebase. Refactor all day long. I’m not going near it.
Those tests tend to have very low value with testing significant refactoring, as the code the tests covers often won't exist anymore.