3 ms·
I use a mocking library mainly to produce stubs. I found verifying mocks too brittle in many cases. Generally I want to test outcomes (state), not behavior. I h
by chopin 6y ago
I use a mocking library mainly to produce stubs. I found verifying mocks too brittle in many cases. Generally I want to test outcomes (state), not behavior. I had many changes breaking tests although functionality was fine.
The example outlined in the article isn't exactly a unit test: The change in state of one object changes the state of another object. If these are coupled that tightly I'd rather try to mock (stub) the dependencies of both objects and let them interact (test both at the same time), then verifying their final state.