Re:Mocks Aren't Stubs (2007)
by gautamdivgi on Monday November 14, 2016 @08:36PM
(#12954920)
Why would it be of concern? I think mocks have a good place in unit tests. I generally believe the premise of unit tests is to test your code against specific pre-conditions. If those pre-conditions cannot be created in a unit testing environment then mocks are justified. I would, however, be very way of mocks moving past unit testing and into integration or system testing (or other varieties like failure injection testing, performance testing, etc.). Mocks have their uses & their limitations. Understanding that is key to using them well.
[ Parent
| on HN ]
Re:Mocks Aren't Stubs (2007)
by wahnfrieden on Monday November 14, 2016 @09:00PM
(#12955044)
It means that you lose out on a lot of value from your test suite: besides verifying behavior on new code, tests also allow you to confidently refactor existing code. If your tests test implementation via mocking, and break when you refactor your code in ways that preserve the intended behaviors, then you're unable to confidently refactor.
Mocks lead you down a path where developers will eventually feel too scared or fatigued to refactor anything substantial.