3 ms·
I would go so far as to say that if your code requires extensive mocking to be tested at a certain level of granularity, then unit tests are the wrong choice at
by int_19h 4y ago
I would go so far as to say that if your code requires extensive mocking to be tested at a certain level of granularity, then unit tests are the wrong choice at that level. Every time I've seen a test suite with abundant mocking, it was mostly testing the mocks - numerous tests get broken by the slightest refactoring and require attention, while real-world integration bugs fly straight through.
IMO functional and integration testing should be where effort is spent first and foremost. If there are resources beyond that, then do finer grained unit testing, but even then closely tracking the amount of time spent on all the scaffolding necessary for it vs the benefits for what gets tested.