Skip to content

Navid's Blog

Ideas, Experiments, and Lessons Learned

Menu
Menu

Why I Stopped Writing Unit Tests for Everything

Posted on March 14, 2026 by Navid

For years, I was that developer. The one who insisted on 90% code coverage. Who would spend hours writing tests for every function, every edge case, every tiny module. I thought more tests meant better code. I was wrong.

The Test Everything Mentality

It started when I joined my first proper dev team. The senior dev there had a simple rule: if it isn’t tested, it doesn’t exist. So I tested everything. Private methods, helper functions, utility modules — you name it.

My test files were longer than my source files. I spent more time writing assertions than writing actual code. And you know what happened? Bugs still slipped through. The same bugs.

What I Learned

After three years of test-obsession, here’s what actually matters:

  • Integration tests catch real bugs — Unit tests are great for logic verification, but they don’t tell you if your code actually works with the rest of the system.
  • Test behavior, not implementation — Testing internal details makes refactoring painful and gives you false confidence.
  • Boundary conditions matter more than happy paths — I wasted so much time testing normal scenarios that I ignored error handling.

My New Approach

Now I test differently:

  1. High-level integration tests for critical user flows
  2. No testing for pure utilities — if a function is simple enough to need tests, maybe it shouldn’t exist as a separate function
  3. Focus on the edges — null values, empty states, timeouts, network failures
  4. Trust your type system — TypeScript or strong typing catches more bugs than tests ever will

The Results

My test count dropped by 70%. My confidence in the code went up. And here’s the controversial part: I have fewer bugs in production now than when I was testing everything.

I’m not saying tests are bad. I’m saying test smarter, not more. Focus on what breaks in production, not what could theoretically break.

The best test is the one that catches a bug before your users do.

Categories

  • AI Experiments
  • Coding
  • Debugging Stories
  • Hot Takes
  • Ideas
  • Lessons Learned
  • Project Management
  • Uncategorized
  • Vibe Coding

Recent Posts

  • How I Handled My First Production Outage (And What I Learned)
  • I Finally Fixed Our Slow Database Queries — Here’s What Actually Worked
  • I Finally Fixed Our Slow Database Queries — Here’s What Actually Worked
  • Why I Stopped Using Microservices for Small Projects
  • I Gave AI Full Access to Our Production Database. Here’s What Happened