DEV Community

Discussion on: Why TDD is Not Working For You

Collapse
 
n_develop profile image
Lars Richter

Hi Arminas,
thanks for your post. It contains a lot of useful tips. I really enjoyed it.

You started with an interesting sentence:

Test-Driven Development seems such a simple technique, yet it causes a wide range of reactions towards it.

First things first: That's 100% true.
But... 😉
I think TDD is not that simple. Or, to put it in better words: Using TDD in real-world projects is not that simple.
I have "learned" TDD years ago. I've read "all the books" ("Test-Driven Development by Example", "Growing Object-Oriented Software Guided By Tests", "The Art of Unit Testing", and so on). I knew how to write tests. I knew "Red-Green-Refactor". Easy. I've done a ton of katas (FizzBuzz, The Bowling Game, Roman Numbers, ...) over and over. Still no problem.
But when it came to (what I call) "real-world" applications, I was paralyzed.
I'm a .NET guy writing most of my stuff in C# and ASP.NET MVC. Where do I start? Do I start with the controller? If so, WHERE in the controller? Controller actions return views (in most cases). Do I test the views? If so, HOW? Do I assert against every HTML element? Or maybe I just test my model? Or is it stupid to test models?

Some day it all clicked. But it was hard work. Learning the stuff that's between FizzBuzz and the complex systems at work. Maybe it took so long because I had the wrong resources. I don't know. But every time I read "TDD is simple", I have the reflex to write a long comment. Sorry about that. 😄

But again: Nice post. Keep up the great work.

Collapse
 
arminaskatilius profile image
Arminas Katilius • Edited

Hello, thanks for you comment. I agree, that is way I wrote that it just "seems like a simple technique".

But I'd say statement that it's simple is still true. Because TDD essentially is just "write failing test, fix code, repeat". So more correctly I would say, "TDD is simple, applying it is not" :)