DEV Community

Bain
Bain

Posted on

TDD and AI-enabled engineering

TRY OUT AI-ENABLED TDD

I've never liked TDD.

I've always found it weird. Maybe I'm so used to working off the back of a napkin that sometimes I'm not sure of all the rules of how the implementation should behave. Maybe I've just not tried TDD enough to really grasp why it's good.

Enter ProjectSpecPilot

A TDD exploration using Cursor and Gemini 2.5 pro. Given the level of noob I am with TDD. Prep was key, got GPT5-thinking to scaffold a bunch of documentation and rules for the Cursor agent to get down to it. Initially it seemed slow and almost boring, watching it create a red test. Do the implementation so it goes green then refactor. But after maybe two hours, I have a working fastAPI that allows the movement of a rover in a grid. 100% coverage across everything except for 86% on main.py. Madness.

I was having so much fun doing this Kata
that I then thought.. well might as well see how TDD works across the whole stack. So I'm dusting off the Three.js (I learnt a bit of this pre-AI development) Lets see what comes out of it. Inspired by this line

Implement wrapping from one edge of the grid to another. (planets are spheres after all)

TDD ui. It's also pretty good. better than normal ui dev then test cycles.

Takehomes.

  • COMMIT YOUR DAMN WORK. I shoot myself in the foot almost every personal project I do. That I always overlook the overhead of commiting changes.
  • It's fun getting an agent to one shot a full stack.
  • It's not fun then trying to get all the code tested. This has actually been a pretty big weakness of mine for a while. Do a whole story in a day, then take four days getting it tested. It's still faster than me handcrafting line by line.. but it's not as efficient as it could be.
  • TDD is absolutely great with AI.
  • AI hallucinates far less. I'm not entirely sure how this has happened. I keep track of how many prompts we've exchanged via one of my global cursor rules. I'm up to nearly 50 prompts and it's not got so drunk that I start abusing it.

No AI's were hurt in the making of this.

Top comments (0)