
Stop Letting AI Write Untestable Code. Add Determinism Back with TWD
Now that AI is generating a big portion of our frontend code, speed is no longer the main bottleneck. Confidence is. We’ve seen this before: when teams wanted to move fast, the real enabler wasn’t “more code” — it was having a solid testing strategy that allowed safe refactoring and iteration. That hasn’t changed. If anything, it’s more important now . In previous posts, I talked about the TWD philosophy, but one idea is key here: Test what you own. Mock what you don’t. With this mindset, TWD (Test While Developing) lets you create deterministic UI tests , where you fully control the environment, simulate any scenario, and avoid flaky behavior. The Problem: Allow AI Know Your Project AI can write tests… but not your tests. It doesn’t know: how your project is structured what should be mocked how your auth works what “good tests” look like in your codebase So even if it generates tests, they often: don’t follow your patterns mock the wrong things miss important flows The Solution: TWD +
Continue reading on Dev.to Webdev
Opens in a new tab




