“Red. Green. Refactor” is a great slogan for Test-Driven Development. It’s less great as a guide to actual TDD practice. The slogan provides no guidance for two very important questions in a TDD process: “What do I test next?” and “How do I break my problem into testable pieces”.
You may have struggled with TDD on these two issues, leading to giving up, or winding up with “uncanny valley” tests that are hard to maintain but don’t provide support for change. Using a puzzle problem, we’ll show how to expand on Red Green Refactor, so you can take advantage of the code-quality benefit of TDD.