What is it exactly? What's the difference between it and Test First Programming?
The questions were raised by one of my colleagues in a Test related activity we had. (Simple curiosity about a handy acronym heard somewhere some time ago and if applicable to what we were doing)
My quick answer: "Test Driven Development is not only about writing your test first! It implies you also see the system as a tester/user. In TDD you ask yourself questions like: What can go wrong? What other scenarios must be considered? Guidance from a preventive QA team would be welcomed in this process... "
Context : we were developing(peering) a new feature - new GUI and related functionality in a TDD manner, writing quickly the functional test (called by us "GUI test") before, and trying to keep the green bar afterward.
After some reflection I realized that TDD is a vague acronym. Why? Because "Development" is also vague.
Development examples :
- explore a simple idea: It might be possible to create this new method that will save us from this amount of code duplication.
- explore a new technology, use it in the application: Can we use hibernate? Yes. We need to use these annotations. Data is persisted.
- design a number of classes with complex behavior: We have performance related problems - we need to cache previously computed results. We must be able to invalidate the cache.
- design a number of classes with complex structure: For the given primary inputs, we must be able to compute and save intermediate results.
- build business structure: Make this "Foo" editable, you did the same for "Bar"
- build business behavior: We have to create these Business rules.
- Test Driven Exploring (driven by learning oriented tests)
- Test Driven Design (driven by design oriented tests)
- Test Driven Structure Implementation (driven by GUI oriented tests)
- Test Driven Behavior Implementation (driven by acceptance criteria oriented tests) - thank god we already have a name for this : BDD
It's been a while since I wrote this post. Reached a very nice post about another TDD meaning:
- Test Driven Refactoring (driven by refactoring oriented tests)