Skip navigation.

Surviving Mock Abuse - My Entirely Arbitrary & Unproven Guidelines For Safe Mocking

Surviving Mock Abuse - My Entirely Arbitrary & Unproven Guidelines For Safe Mocking

There's no doubt at all that mock objects are a powerful tool in our quest for high levels of unit test assurance, and can be very helpful in the test-driven design process.

But they can come at a price. If we overdo it, and abuse mocks, then we can end up thwarting our goal of making code easier to change.

The danger with mocking is that we are making assertions about interactions, which are often an internal design detail. This is a kind of white box...