3 ms·
The central idea of a ‘unit’ test is that its failure should implicate one, and only one, part of the codebase. So while isolating tests is a necessary part of
by thom 5y ago
The central idea of a ‘unit’ test is that its failure should implicate one, and only one, part of the codebase. So while isolating tests is a necessary part of this (stale state from other tests would cloud the reasons for failure), I’ve never heard this isolation proposed as the primary feature of a unit test.
- bluGill 5y agoI've come to disagree with the idea that a test is for only one part of the code. In the real world if a test breaks you know what broke it: the last change you made. Thus it doesn't matter in the worst case, and in the best case it warns you of a weird situation more isolated tests wouldn't have caught. There is such a thing as tests that fail randomly of course. Investigate and fix them.