Stage 5 · Lesson 1 of 6
Tests as the specification
A test written before the code is a specification you can run. It says exactly what the code must do, in a form that cannot be argued with: it passes or it fails. With an AI tool, that changes everything.
Instead of "done" meaning the tool stopped, done means the tests pass. The tool can run them itself and keep going until they do, and you review evidence instead of claims. Tests written after the code by the same tool tend to describe whatever the code happens to do, including its bugs, which is why the order matters. Start with the behaviour you care about most, written as one clear test.
Common trapasking the tool to write the code and its tests in one go, so both share the same misunderstanding.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- BookFreeTest-Driven Development with Python (Obey the Testing Goat)
Harry Percival · Intermediate
Free online: test-driven development taught step by step on a real web app
- BookPaidTest Driven Development: By Example
Kent Beck (Addison-Wesley) · Intermediate · Paid
Kent Beck's short classic on the red, green, refactor loop, worked through by example