Hacker News new | past | comments | ask | show | jobs | submit login

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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: