3 ms·
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
by mcherm 3y ago
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).
- Maxion 3y agoA 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?