Recently I have been writing some completely new code using TDD (no dependencies to existing functionality). With Kent Beck's money example fresh in memory I realized that I should write the tests, defining the wanted functionality, without any thoughts on the implementation. The application code should then be written without any constraints on number of classes etc.
When I wrote the application code I tried a number of different approaches, adding and removing classes along the way, until I ended up with something that was clean and easy to extend when needed. All the time I had the tests running so that I could feel confident that my changes did not break anything.
Also, as I kept adding new tests, some of the already existing ones became redundant, so I removed them to avoid duplication. Now, the tests does not cover every single edge case, and I am still unsure if it is the responsibility of the tests written during TDD to do that. Any thoughts on this are welcome.
When I wrote the application code I tried a number of different approaches, adding and removing classes along the way, until I ended up with something that was clean and easy to extend when needed. All the time I had the tests running so that I could feel confident that my changes did not break anything.
Also, as I kept adding new tests, some of the already existing ones became redundant, so I removed them to avoid duplication. Now, the tests does not cover every single edge case, and I am still unsure if it is the responsibility of the tests written during TDD to do that. Any thoughts on this are welcome.
Kommentarer
Skicka en kommentar