4 ms·
> If code is highly coupled, tests become highly coupled and a nightmare. TDD is supposed to prevent that. What's supposed to happen is, if the test is hard t
by AnimalMuppet 9y ago
> If code is highly coupled, tests become highly coupled and a nightmare.
TDD is supposed to prevent that. What's supposed to happen is, if the test is hard to write, it's telling you something. You're supposed to pay attention to that pain. It's supposed to show you that your code is highly coupled, and make you fix that.
If you just go ahead and write the test, difficult as it is, instead of finding a way to refactor to clean up the coupling, then yes, TDD produces a nightmare of a test. That's because you're not doing it right, though.
(Yes, I recognize that this is a lot like a No True Scotsman. But in fact any methodology, practiced badly, will produce sub-optimal results...)