ATDD: Don’t skip tests even for simple code
Learning the hard way: even “simple” code needs tests. Automated testing isn't just for big complex projects.
As I was building a template generator - a task that should be very simple - I first gave the manual procedure to Copilot to implement. It implemented it wrong.
As I’m running the first cohort of ATDD Accelerator for 2025, because it’s practical, one of the first things we do, is TDD sandbox setup. Now, the trouble is that even setting up a simple project takes time. Setting up a pipeline takes time.
So I thought, to make it easier for everyone, I’d make a template. It’s a multi-language template, and I’m basically automating it. To automate this, I have a GitHub template, and I want to automate the process of creating a new repository from that template and then doing some post-processing on top.
The Simple Task That Wasn’t So Simple
First, I documented everything manually through my quickstart. Then I wanted to automate it. I went with PowerShell. And since I’m not really an active PowerShell user, I decided to use Copilot to help me generate the code. I gave it the quickstart, it generated the script, I ran it - and it didn’t work.
I thought, “Well, it’s simple. I’ll spend a few hours and get it to work.” But what happened was, as I was trying to get it to work, every time I needed to do manual testing: open up the generated repository in GitHub, check which folders were there, verify if substitutions were done or not, and then manually delete the repository.
None of this was complex - it was simple, repetitive work - but it ended up taking me hours. And after all those hours, I still didn’t have anything actually working.
AI Wrote Meaningless Tests
So I thought, “Okay, let’s try AI again. Maybe I should start with tests first.” I gave Copilot the quickstart and asked it to generate test cases. It generated lots of them, but when I looked, many were meaningless. Some were too tightly coupled to the setup steps in my quickstart, and not really asserting end results. And the tests were hard to read.
Back to Basics: The First Test
That was the wake-up call. ATDD isn’t just for big company projects - it applies even here. Even for this silly, simple script, ATDD is the way to go.
So I scrapped everything Copilot had done before and started over. I wrote the very first test - “hello world,” basically just checking if the repository was even created. Then I added the next test, verifying whether a certain folder exists or doesn’t exist after post-processing. And then I asked the AI to make the test pass.
At first, Copilot generated way too much code - more than was needed to make the test pass. Then I refined the prompts to ask it for only the minimal code required. That worked better.
Slow Start, Fast Momentum
Yes, the first setup took time. Writing those first tests, creating the DSL for interfacing with GitHub CLI, wiring it up to the template generator script, and setting up GitHub Actions - all of that took hours. It was slow in the beginning. But once the foundation was in place, writing the next test was super fast - within a minute I could write the test and then have the AI generate just enough code to pass it.
So that’s how I accelerated my own development: on one hand, I built maintainable acceptance tests, which made it cheap to add the next test. On the other hand, I minimized coding time by using Copilot incrementally. Ultimately, that reduced overall development time.
🚀 Join the ATDD Accelerator waitlist.