3 ms·
#1 is very likely. However if it is extremely common to do unit tests "wrong", then that would mean I would need to find a testing guru to learn from in order t
by justanotherc 7y ago
#1 is very likely. However if it is extremely common to do unit tests "wrong", then that would mean I would need to find a testing guru to learn from in order to do it "right", and do a great deal of study to learn myself. The possibility of that happening is very low.
Does this not give credence to the notion that there may in fact be something wrong with unit testing in general? Is it not just compounding the problem?
I'd rather spend my limited cognitive currency and time in the system itself, not in mastering the art of unit tests... Unit testing should be a tool not an art. If a tool doesn't simplify my life, it has limited utility.
- notacoward 7y agoI 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.