ai April 24, 2026 6 min read
Red/Green TDD When Your Dep Is a Generative API
How to test-drive code that integrates with Gemini, Claude, or any non-deterministic API — without pretending the API is deterministic.
Gemini does not care about your unit tests. But your unit tests can still be green, fast, and trustworthy — if you put the seam between your code and Gemini in the right place. Here is the pattern we used to ship a CMS image-generation feature in under a day, with every layer TDD'd and the Gemini boundary mocked without hand-waving.
Keith Pattison
Founder, Black Flag Design