4 ms·
> In this article I will be relying on the “standard” definitions, where unit testing targets smallest separable parts of code Maybe that is the standard under
by goto11 5y ago
> In this article I will be relying on the “standard” definitions, where unit testing targets smallest separable parts of code
Maybe that is the standard understanding, but I don't think it was the original meaning, and I don't think it is a helpful definition. Testing only "smallest separable parts" is what leads to an over-reliance on mocking and brittle tests.
Unit test should test a "unit of behavior", not a unit of code. That is, a unit test should test a single assertion about the behavior of a component. The test should not care how the behavior is implemented, i.e. it should be possible to refactor or fully rewrite the implementation without changing the test, which means the test should not care if one or many sub-component are involved (as long as no external systems are involved).