I feel like this would be the way to go to minimize non-valuable testing while allowing you to discover code thats becoming more leveraged and therefore more critical to test.
I feel like this would be the way to go to minimize non-valuable testing while allowing you to discover code thats becoming more leveraged and therefore more critical to test.
2. This feels like the job of a code coverage tool to me (and it's something I would like as well), but most coverage tools I've seen don't quite have the granularity you're looking for. In certain ecosystems you could hack something together pretty quickly (e.g. the `trace` module in python).
Correct me if I'm wrong, but this idea sounds like you'd like to bias your tests away from small units and toward integration tests (and a similar tool could be useful for dead code elimination and a few other tasks). I know they're not a panacea in general, but in your personal experience what problems have you found in fine-grained tests that outweigh their benefits?
I'm a believer in "right-sized" testing, meaning balancing the cost of test creation and updating against the value the tests provide. I believe tests provide the greatest value when they are testing: * public methods * critical business logic * highly reused core logic
in other words, "code for others".
For code that's used for one specific page render or something similarly isolated, I think it's more questionable whether to bother going for 100% code coverage.
The latter category is where I'd like to "trust but verify" with devs permitting them to opt out of unit tests where they believe the code isn't critical, but have some confidence that we would catch code if it became more central and then enforce testing requirements.