i love mocks. i really do. if i could, i would marry mocks, have lots of mock babies, be a grandmock; you get the idea...
the top reasons i love mocks:
1. focus only on what you are testing
2. other classes won't break your tests
3. create new interfaces and use them before they exist
4. use functionality without knowledge
5. i hate math
6. keep the file system, networks and other real resources out of your unit tests
i'll post examples of each of these reasons
a lot of black box testers have valid reasons for disliking mocks, but the benefits surpass any downside i have ever read or encountered. i use rhino mocks, which uses reflection, so some major downsides of mocks, such as difficult refactoring and type casting are completely avoided.
did i mention i love mocks?
thank you rhino mocks!!!
One other must with mocks is dependency injection. In the past I've written my own object management framework to handle injection, but we've been using the castle framework and its totally excellent, i love this too!!! It takes away all the thinking of dependency injection and lets you focus only on your tests and interfaces. An absolute must!!
{ 0 komentar... read them below or add one }
Posting Komentar