News for hackers. Stuff that matters.
Re:Don't Use Mocks by mcherm on Tuesday June 20, 2023 @10:59AM (#36405020)
Sure, the title is clickbait. But the message seemed useful: if your test rigidly requires every call be made in exactly the way it is made now, then your test will be brittle. For a less brittle test, re-implement the functionality in a simpler form.

What this article did not do was to describe the trade-off: what you give up by creating a more complicated "fake" (to use the author's term).

Re:Don't Use Mocks by Maxion on Wednesday June 21, 2023 @02:20AM (#36415049)
A naive question here, should I not then in a unit test, test that an API library is called with specific arguments?

I am confused, wouldn't using simpler and "broader" tests miss test coverage on e.g. specific error handlers?