4 ms·
I'm a big fan of unit tests and from my perspective, this article misunderstand what unit tests are for. Unit tests verify that the central assumptions you've m
by spacekitcat 6y ago
I'm a big fan of unit tests and from my perspective, this article misunderstand what unit tests are for. Unit tests verify that the central assumptions you've made about some module's behaviour hold water. Unit tests aren't supposed to "exercise user behaviour" or "verify business logic", it verifies the theoretical behaviour of a carefully isolated module under specific conditions. A well crafted suite of tests makes it easier to reason about your application's behaviour.
- theshrike79 6y agoThis is the correct way, but in my experience less-traveled programmers start striving for that elusive 100% coverage and end up writing unit tests for completely obvious stuff like constructors (which do nothing else than setting values) or setters/getters.
- spacekitcat 6y agoDevelopers always have to estimate the cost/benefit of how they're spending their time and overly strict coverage targets get in the way of that. Test coverage targets make very little sense for a statically typed language like C#, a fools errand almost. In dynamically typed languages, it's hard not to almost hit 100% if you're doing some honest TDD. Just for example.