Test-Driven development is hard

Filed under: TDD, — Tags: Test-Driven Development — Thomas Sundberg — 2019-10-31

I had a conversation with a developer this spring about Test-Driven Development, TDD. We both agreed that it is a good habit.

I asked why he doesn't do more TDD than he does. He is not using TDD as his default mode when writing code. His answer fascinated me.

I don't know if it should be a rest api or something else.

If that is the conditions you work under, I can absolutely understand if TDD is the least of your problem. I can definitely understand if you don't use TDD in that context.

There are few problems here that will make it really hard to do TDD

Unlimited scope

You don't know your scope. Therefore it is hard to know where to start and it is impossible to know when to stop. Which acceptance test that should pass so you can define the work done? With an unlimited scope, you can't define the acceptance criteria.

TDD without an idea of where you should end up is a random walk with no goal. It might be a better idea to just sit tight and not do anything until you have a better understanding of where you want to end up.

Must have a goal

Building something without a goal is a bad idea. Always make sure you know where you should end up. Even if you don't have all the details, make sure you have some kind of idea.

I'm thinking of a quote from Alice in Wonderland:

“Would you tell me, please, which way I ought to go from here?"

"That depends a good deal on where you want to get to."

"I don't much care where –"

"Then it doesn't matter which way you go.”

― Lewis Carroll, Alice in Wonderland

Without a goal, don't start walking. You will not end up in a good place. Without an idea of where you want to end up, don't start implementing a program.

Acknowledgements

I would like to thank Malin Ekholm and Mika Kytöläinen for feedback.

Resources



(less...)

Pages

About
Events
Why

Categories

Agile
Automation
BDD
Clean code
Continuous delivery
Continuous deployment
Continuous integration
Cucumber
Culture
Design
DevOps
Executable specification
Gradle
Guice
J2EE
JUnit
Java
Javascript
Kubernetes
Linux
Load testing
Maven
Mockito
New developers
Pair programming
PicoContainer
Presentation
Programming
Public speaking
Quality
React
Recruiting
Requirements
Scala
Selenium
Software craftsmanship
Software development
Spring
TDD
Teaching
Technical debt
Test automation
Tools
Web
Windows
eXtreme Programming

Authors

Thomas Sundberg
Adrian Bolboaca

Archives

Meta

rss RSS