3 ms·
I don't exactly disagree with you. I've been on many projects where unit tests failed to justify the time spent writing them (including mocks) and dealing with
by notacoward 7y ago
I don't exactly disagree with you. I've been on many projects where unit tests failed to justify the time spent writing them (including mocks) and dealing with spurious failures. I believe they can be beneficial, but only if people understand their limitations and play to their strengths. I'll gladly use them to vet code that implements a completely self-contained data structure or algorithm with no dependencies, and I've done so to good effect many times. Otherwise, I'd rather write a proper stub/simulator that can be used in integration tests to exercise multiple components at once than waste time with single-purpose mocks.
> I'd rather spend my limited cognitive currency and time in the system itself, not in mastering the art of unit tests
That's not quite an either/or. Over an entire career you'll probably work on many systems each requiring their own specific knowledge. Knowing one system is great as long as you're working on that system, and mostly useless thereafter. Knowledge of how to write good tests (unit or otherwise) is much more transferable. Every team can use somebody with those skills.