In general, units are tested using only the public interface of the unit (aka “public API” or “surface area”). This is referred to as black box testing. Black box testing leads to less brittle tests, because the implementation details of a unit tend to change more over time than the public API of the unit. If you use white box testing, where tests are aware of implementation details, any change to the implementation details could break the test, even if the public API continues to function as expected. In other words, white-box testing leads to wasted rework.
Mocking is a Code Smell
Eric Elliott
8.6K60

I’ve been trying to explain this at my current role. This paragraph will be copy pasted upon my return from holiday!

Like what you read? Give A. M. Koch a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.