Tests first, written by you

Lesson 13 of 27 · Verify what it produces · 2 min Get the course to watch

An agent that writes both the code and the tests is marking its own homework. The tests will pass, because they were written to pass. The version that actually protects you is simpler: you decide what must be true, as a failing test, before the agent writes a line.

The rest of this lesson

  • Red then green
  • Fail for the right reason
  • Hand over the red test
  • Let the agent draft you review

The full lesson is animated and narrated, with a short quiz, and you can pause it to ask a question. It comes with Engineering with Coding Agents.