3 ms·
So how do you write a test for a case you couldn't foresee? You don't, but once you discover it, you write a regression test to make sure it doesn't come back.
by youngian 17y ago
So how do you write a test for a case you couldn't foresee?
You don't, but once you discover it, you write a regression test to make sure it doesn't come back.
However, IANATDD, I am not a test-driven developer - I don't see any reason to be dogmatic, but I do think unit tests can be extremely valuable. So this answer might not be TDD-approved.
- InclinedPlane 17y ago"So how do you write a test for a case you couldn't foresee?" "You don't, but once you discover it, you write a regression test to make sure it doesn't come back." Sure, that's SOP in any good dev. house that does testing. But you've failed to address a key weakness in TDD. The real question is how do you discover these sorts of defects given that a single developer writing in a TDD style is unlikely to do so? TDD is clearly not a cure all, and this is a major weakness of it. Other development techniques, many of which can complement TDD, such as formal code reviews and beta testing can do a better job of getting you to higher product quality than TDD alone.