4 ms·
> "Striving for 100% test coverage is nonsense" 100% coverage of what exactly? Tests that go through all your lines of code without testing any of the logic, i
by mcv 6y ago
> "Striving for 100% test coverage is nonsense"
100% coverage of what exactly? Tests that go through all your lines of code without testing any of the logic, is useless. If you want to be thorough, you need to do mutation testing, which is a system that tests the quality your unit tests by mutating your logic (changing a > for >=, a + for -, etc) and then expects at least one test to fail. If no test fails, that piece of logic wasn't tested.
Without that, it's entirely possible your high code coverage doesn't actually test anything meaningful. Also, this sort of logic is exactly the kind of stuff you want to unit test. All the standard plumbing boilerplate code is not something that needs to be unit tested. The logic does.
- 2rsf 6y agoand it's not just that, for example branch coverage only says that you branched but not how, a complex branch might need more than one test to be fully, or decently, tested.
- zzzcpan 6y agoRight, essentially you have to be aware that you are testing the state space the code might end up in, which is very different from just hitting every line of code or every branch.