TDD doesn't mean you know everything upfront

I'm in the final phase of a Drupal development project for a customer.

It has some custom modules and code I wrote with automated tests and test-driven development.

Today, the client reported a bug.

But, instead of something working incorrectly, this was a use case I hadn't considered.

The tests were passing, but there wasn't one for this.

I wrote the code for the use cases I was aware of when I started, and now I'm aware of another, I can add a test for it and ensure it's tested and working.

To do test-driven development, you don't need to know all the use cases and functionality upfront.

Write for what you know at the time, then expand and iterate in the future.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.