Chapter 10: Tests

Red, green, refactor

Also called Red/green TDD

The TDD cycle in three steps. Red: write a test and watch it fail. Green: write just enough code to pass. Refactor: tidy up while the tests stay green.

For an agent, red is the step that matters. A test that passes before the code exists is a test that can't fail, and an agent left alone will skip straight past that without noticing.

Say it to your agent

“Show me the red: paste the failing test output before you write any code. If a new test passes on the first run, stop and tell me, because it isn't testing what we think it is.”

The workshop

Name a word, or describe what you mean in everyday language.