6 ms·
I don't get the "don't aim for 100%" point For me the point of that one is that test coverage isn't the goal - good code is. I've seen folk disappearing down
by adrianhoward 15y ago
I don't get the "don't aim for 100%" point
For me the point of that one is that test coverage isn't the goal - good code is.
I've seen folk disappearing down a rabbit hole focusing on getting that last 2% of branch coverage using some baroque mock object monkey patched into the system. Their focus was on test coverage. What people who focus on test coverage get is an evil complex test suite that's very brittle in the face of change.
Other, smarter, folk go "damn - I can't test that easily - this code sucks", factor out unrelated functionality into appropriate classes, add some code that makes some duplication between branches obvious, factor out the duplication and end up with something that's better code, with simpler tests - and better test coverage too. Their focus is on the code - not the test coverage.
[Edited for... erm... English]
- deleted 15y ago[deleted]
- pyre 15y ago> damn - I can't test that easily - this code sucks Depends on what you're doing. If you're writing a report that relies on a bunch of complex datasets, then it's a pain in the ass to generate said datasets, and calculate the expected result, but the test itself is fairly simple.