Sitemap

Test-Driven Development (TDD) and AI

2 min readMar 30, 2025

How AI tools can help or hinder in a TDD approach

Image shows a circle illustrating the iterative nature of TDD: write failing test, make the test past, refactor, then repeat. Image credit: https://crafter.ai

One of the things I like the most about test-drive development (TDD) is that it makes you think about what your next test should be.

At times this means you need to rethink the business logic, perhaps even have another chat with your users, your customers or our product owner. In this case it improves your understanding of the business domain.

At other times it may result in taking yet another look at the code you already have and find options for improving it. What is the next incremental piece of logic you can implement? Or asking differently: given that you want to add a particular piece of code, what test do you have to write that fails without that new piece of code but passes with the new piece of code (or code change) in place?

While doing so, you can also experiment. For example, comment out some code and see if the test suite still passes. Obviously, it pays to have a comprehensive test suite that completes very fast. If you have used TDD from the beginning, you already have that.

As you work with the “soft”-ware, you deepen your understanding of the code base. The code you are looking at may have been written by a different person. Or it may have been written by you many months ago, and…

--

--

Manfred Lange
Manfred Lange

Written by Manfred Lange

Software craftsman and keen learner. I write about improving flow of value in software engineering. LinkedIn https://www.linkedin.com/in/manfredlange

No responses yet