Skip to content

But I can write my tests later", you say. No, you can't…

“But I can write my tests later", you say. No, you can't. Not really. Oh, you can write some tests later. You can even approach high coverage later if you are careful to measure it. But the tests you write after the fact are defense. Tests you write first are offense. After-the-fact tests are…” quote by Robert C Martin
Download Open image
““But I can write my tests later", you say. No, you can't. Not really. Oh, you can write some tests later. You can even approach high coverage later if you are careful to measure it. But the tests you write after the fact are defense. Tests you write first are offense. After-the-fact tests are written by someone who is already vested in the code and already knows how the problem was solved. There's just no way those tests can be anywhere near as incisive as tests written first.””

Robert C Martin

About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Writing tests before code creates proactive, precise checks; post‑hoc tests are reactive and less effective.

In simple terms: First‑write tests are stronger than later ones.

Key Takeaway

Write tests first.

Themes

software engineering testing quality assurance

Mood

cautious analytical

Type

advice technical

When to use this quote

  • code reviews
  • continuous integration
  • pair programming
  • refactoring

Key Concepts

test‑driven development defensive programming

Questions to Reflect On

  • How can you ensure test coverage early?
  • What risks arise from retroactive testing?
A Different Perspective

Later tests may miss hidden assumptions.

★ ★ ★ ★ ★ No ratings yet

More by Robert C Martin

Explore all 4 Robert C Martin quotes

More Tests Written quotes

Browse all 2 Tests Written quotes