I once saw a FAANG codebase with 100% test coverage but the system was still broken ⚡
Many big companies obsess over unit tests and most of them chase the vanity metric of test coverage as an indicator of system stability. The obsession with hitting that 100% coverage mark leads to engineers wasting countless hours writing trivial test cases.
I am not saying, to not write tests at all. Tests are essential and you need to write the ones that matter, the tests that catch regressions, the tests that ensure the core functionality remains intact, and the tests that keep the system stable.
I prefer writing integration tests because they ensure that my system is stable from the outside and that the required user flows are working fine. I do write unit tests, but only for critical business logic and complex internal flows and edge cases.
Five pieces of code that I write unit and integration tests for are
- for functionality that directly impacts the user experience
- for the system’s core business logic
- for code that gets invoked frequently
- for code that handles sensitive data
- for code that changes frequently
So, when you write the next set of tests ask yourself, your lead, and your manager the tough question - “why?”
⚡ I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.
my knowledge base - arpitbhayani.me/kb subscribe - youtube.com/c/ArpitBhayani