Comment

Comment by ilovwindows

I agree with the author. Some devs take unit testing too literally. I have come across tests which mock every units that a component being test depends on. It's a terrible practice. First mocks are hard to maintain and second over time this friction generate disparity between real code and mocks. I have seen tests that pass even when the actual implementations have diverged.

The rule of thumb is, if you can test without mocks don't mock.

Most of the tests we write are integration tests not unit tests. Even at function level, a function being tested calls multiple other functions to get the things done.

parent ilovwindows 5 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton