3 ms·
Yeah that's a good breakdown of the different approaches. We started using DI, and then had a rule that all unit tests need to be isolated. Which means mockin
by MrEnigma 15y ago
Yeah that's a good breakdown of the different approaches.
We started using DI, and then had a rule that all unit tests need to be isolated. Which means mocking everything they touch.
For small methods it makes them very fragile, although the other way you end up getting a lot of intertwined tests that can wreak havoc after a lot of tests are made if you're not careful.
I've found that picking what you want to isolate seems to work the best. Our unit tests isolated everything, integration isolated any connections (i.e. DB/Services/etc) which made the tests much less fragile (and much more valuable), but made the errors harder to track down.