If you've been in software development for more than five minutes, you've heard it: "We need 80% test coverage." It's everywhere — bandied about in retrospectives, pull request templates, and job descriptions. But where does it come from? And more importantly — where do integration and end-to-end tests fit into the picture?

🧩 Where Did 80% Even Come From?

The 80% figure looks suspiciously like a convenient application of the Pareto principle: 80% of your problems come from 20% of your code. It's a round number that feels ambitious without feeling impossible. But it is not a law of nature — it is a heuristic. And like all heuristics, it breaks down when treated as a hard target rather than a helpful guideline.

Coverage tells you which lines were executed during a test — not whether the test actually checked anything useful. It is common to see codebases with 90% coverage that still ship catastrophic bugs because tests were exercising code without asserting on its behaviour.

🔺 The Testing Pyramid — Ratios, Not Percentages

The better question is not "what percentage?" — it is "what balance?" The Test Pyramid, originally from Mike Cohn and popularised by Martin Fowler, remains the most sensible mental model we have for structuring a test suite:

 /\ / \ E2E Tests ← 5–10% — Fewest, slowest, most brittle /____\ / \ Integration ← 20–30% — Medium, verify how components connect /________\ / \ Unit Tests ← 60–70% — Fast, cheap, isolated logic 

Classic guideline: roughly 70/20/10. More tests at the base where they are fast and inexpensive to run; fewer at the top where they are slow, costly, and prone to flakiness. Crucially — this refers to the proportion of test cases, not code coverage percentage. That distinction is where most confusion arises.

📈 So What Should Teams Actually Aim For?

Here is a realistic breakdown of what "good" looks like at each layer:

✅ Unit Tests

  • 70–80% line coverage across the general codebase is a reasonable baseline
  • 85–95%+ on critical paths — authentication, payment processing, core business logic
  • 50–70% for low-risk code, internal utilities, or view-layer components is perfectly acceptable
  • 100% is rarely worth the investment — the final 5% of coverage typically costs 50% of the effort while yielding diminishing returns

Better than chasing a percentage: Track branch coverage rather than just line coverage. A line can execute completely while half its conditional logic remains unexercised. For high-stakes modules, consider mutation testing — a 70% mutation score indicates meaningful test quality and is worth infinitely more than 95% line coverage with weak assertions.

🔌 Integration Tests — "Percentage" Is the Wrong Metric

Integration tests verify that components work correctly together — databases, external APIs, message queues, and internal service boundaries. Code coverage percentages do not meaningfully apply here. Instead:

  • Aim for 100% coverage of critical integrations — every database query, API contract, and service boundary that carries user data or executes business rules
  • Test both happy paths and failure modes — timeouts, retries, invalid inputs, and degraded dependencies
  • Start with the question: "Which systems must communicate correctly for our core features to work?" — then design tests around those boundaries
  • Integration tests typically make up 20–30% of the total test suite by count, not by code coverage

🖥️ End-to-End Tests — "Which Journeys?" Not "How Much Code?"

E2E tests simulate real user behaviour through a running application. They are slow, resource-intensive, and prone to environmental instability — but they are also the only tests that validate the system as a whole. The goal is as few as possible, but as many as necessary.

  • Keep E2E tests to roughly 5–10% of your suite — think dozens, not hundreds
  • Maintain 100% coverage of critical user journeys — account creation, authentication, purchase flows, and key deliverables
  • Secondary paths and edge cases belong in unit or integration tests — not your E2E suite
  • If your full E2E suite takes longer than 15–30 minutes to complete, it has grown too large

🎯 Context Changes Everything — No Single Number Applies Everywhere

The right targets shift depending on what is being built and what risks matter most:

System Type Unit Test Target Integration Strategy E2E Approach
Core business / payments 85–95% Full API + database contract coverage Happy paths + key error states
Main application 70–80% Key service boundaries only Critical journeys only
Internal tools / admin UI 50–70% Smoke endpoint verification Basic sanity checks
Libraries / SDKs 90%+ Full public interface coverage Minimal or none
Prototype / experimental 0–50% — prioritise learning Manual verification Manual validation

✅ Practical Good Practices

  1. Coverage is a diagnostic tool, not a performance metric. Optimise for confidence, not percentages
  2. Apply risk-based testing: The 20% of code that carries 80% of your business risk deserves the most thorough testing investment
  3. Avoid the Ice Cream Cone Anti-Pattern: When E2E tests outnumber unit tests, suites become slow, flaky, and teams stop running them — rebalance toward the base of the pyramid
  4. Every escaped bug earns one test. When issues reach production, add one appropriate test — this builds a useful suite organically over time
  5. Delete ruthlessly. Tests that verify implementation details rather than behaviour — remove them. Tests that never caught an issue — remove them. Test rot is a real maintenance cost
  6. Match test type to purpose:
    • Unit → Does this piece of logic behave correctly in isolation?
    • Integration → Do these components communicate and cooperate correctly?
    • E2E → Does the key experience work for a real user?

🎬 Closing Thoughts

The reason there is no industry-wide consensus on the "right" numbers is simple: there is no universal answer. Eighty percent is a decent starting point for conversation, but it should never be treated as a destination. Integration tests are not measured in percentages — they are measured by whether the critical connections your system depends on are reliable. E2E tests do not exist to cover code — they exist to cover what matters to users.

A good test suite is one where: engineers trust the results enough to merge with confidence; failures clearly indicate what went wrong; and the full suite runs quickly enough that developers actually run it locally before pushing changes. If those three things are true, the numbers are already good enough.

Thanks for reading — what does your team aim for in practice? Are there coverage rules you've found helpful, or targets that created more problems than they solved? The discussion continues in the comments!