3 ms·
But the code containing the bug is already there. The idea of TDD is that you write tests verifying behavior before there is any code.
by tokenizerrr 9y ago
But the code containing the bug is already there. The idea of TDD is that you write tests verifying behavior before there is any code.
- richardknop 9y agoIf you are writing something from scratch yes. But if you inherited a codebase written by somebody else who didn't to TDD so there are no tests, you can still use TDD for refactoring. So any new changes/bugfixes you will make to this legacy codebase, first you will write a test and then make change. That's pretty standard. Many legacy codebases will have no tests and people who wrote the code will have left long time ago.
- ZoFreX 9y agoThis definition of TDD either supposes that it is possible to write software with zero bugs using TDD, or that your project ceases to be TDD as soon as a bug is discovered, or any other change is required. I propose this definition is not very useful.
- tokenizerrr 9y agoI see that as just writing regular unit tests, business as usual. Not TDD, still very useful.