mercredi 28 janvier 2015

Benefits of loose coupling for unit testing

What are the benefits of loose coupling on unit testing?


As I understand it, loose coupling is all about focusing on abstractions rather than concretions.


I've read that one benefit is the ability to more easily stub (easymock, mockito, etc.) or mock (instantiate and populate a compatible class) the dependency. But, even with tight coupling I can do that just as easily...


So, what am I missing? Is it that stubbing enables you to isolate the unit test from the rest of the system, thus narrowing down the potential cause of the failures, while mocking (as I define it) does not?


Aucun commentaire:

Enregistrer un commentaire