3 ms·
When the code needs additional functionality, then yes, I'd say that TDD indicates you should create a failing test case. But if you are adding additional test
by joevandyk 17y ago
When the code needs additional functionality, then yes, I'd say that TDD indicates you should create a failing test case.
But if you are adding additional test cases to prove that edge cases work correctly (and no code changes need to happen), then I don't see why you'd need to have a failing test case, and I don't know how you could argue for it.
- dalke 17y ago"I don't see why you'd need to have a failing test case". It's going to depend on the case, but I've had enough times in Python where I've written (via copy & paste) a new test case and forgotten to change the name, so the new test replaces the old, that I slightly wary of trusting that new test code which seems to pass, actually did run. On the other hand, if I have two parallel lists, one with input parameters and the other with expected results, and I add a new test case to those lists, then I'm not going to worry so much about the new test passing by accident because the likelihood of making an silent error there is quite small.