vogel

Why I’m banning AI agents from writing tests

Agent-written tests mirror the code instead of protecting the product, so I made them opt-in.

· · 3:24 video · Opinion

I’m not against tests. Tests are excellent: they make sure code does what it’s supposed to do. The problem is how AI agents write them.

Agents write code, then write a test tuned to that code’s output. When the code changes, they update the test to match. Developers write tests to lock in a working state, not to mirror every change.

Summary

  • Developers write tests first, or after the product works, to freeze that working state.
  • Agents fall into a loop of writing code, writing a test, updating the code, then updating the test, and lose sight of the product.
  • My AGENTS.md now makes new test files opt-in: no new unit, integration, end-to-end or spec tests, helpers or fixtures by default.
  • The trigger: while building the homepage for MailMeLater, an agent wrote a test only to check that a noise texture image returned a 200.

How to apply it

  1. Add an opt-in rule for new test files to your AGENTS.md so agents don’t create them unless you ask.
  2. Build the product first and confirm it works end to end.
  3. Then ask the agent for tests that lock in that state, and describe how you want them shaped.
  4. Reject tests that only confirm a static file exists or restate the implementation.

More from vogel