24
[Question] How can you develop test driven when you don’t know where you’re going in the first place?
11 Comments · Posted by Christian in Question
I’ve got this one question puzzling me for quite some time now and I got to get it off my chest.
An just to make sure there are no misunderstandings: I am not about to question TDD!
I am merely asking for help to find my way to do it properly..
So what is Test Driven Development?
Well it comes down to this:
- You write a test first and then implement until it no longer fails.
- You do this in a circle and start over and over again until all requirements are represented by a test which passes.
- There is an inner and an outer circle. The outer circle is a functional test and the inner is a unit test.
This sounds simple enough assuming that there is a clear vision of where to go.
But how often do you find yourself in a position where you are not only responsible for implementing a requirement but also for its specification?
Just recently I worked on a symfony plugin called gjPositionsPlugin and the only requirement was:
Users should be able to place page elements and contents on a page in one easy to use tool.
So I started building that tool and during the time I refactored a lot. And with refactoring I mean redesigning. The result (or its current state) is completely different from what I started with.
I started with a simple module which grew into a complictaed module which became incredibly complex which I refactored into form classes which grew completely out of proportion which I then realised could be simplified by creating doctrine behaviours which brought me to the idea to create an admin theme which gave me the opportunity to move a lot of its complexity towards the jquery site, … well, you get the idea.
This one very abstract requirement still applies but the details were not clear in the beginning. In fact it was the process of coding that led me to the specific requirements.
And I can not for the life of me imagine how I could’ve done all that with writing tests beforehand.
Also I keep thinking about all those tests I would have binned along the way. How much time would I have spent on writing tests that would not survive until the end?
I am sure this situation and those questions present themselves to most of you who tried TDD. How did you go pass that? What’s the trick?
best practice · Functional Tests · Integrations Tests · Refactoring · TD · Test Driven Development · Tests · Unit Tests
-
http://mrclay.org/ Steve Clay
-
http://christof.damian.net/ Christof
-
Crafty_Shadow
-
http://devfactor.blogspot.com Richard
-
http://www.glatter-gotz.com Henning Glatter-Gotz
-
http://devfactor.blogspot.com Richard
-
http://www.zalas.eu Kuba
-
Matthias


