Chapter 10: Tests

When should the test get written? People have argued over this for twenty years, and the evidence has not settled it.

Test-driven development

Also called TDD

Writing the test before the code that makes it pass, in very small steps. The test fails first, because the code does not exist yet, and that failure is the point.

With agents the argument changes. A test written first can't be fitted to the code, and watching it fail shows it can fail at all. Those are strong reasons whatever the studies say about people. We found no good trials on agents.

Say it to your agent

“Use red/green TDD for this. Write one test, run it and show me it failing. Then write the least code that passes. One test at a time, and do not change a test to get it to pass.”

The workshop

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