04-28-2015 03:58 AM
Was just sent a link to an Uncle Bob post that describes these really well:
http://blog.8thlight.com/uncle-bob/2014/05/14/TheLittleMocker.html
The guy I was chatting with has a post on the topic where he suggests a priority of these based on complexity:
http://www.urlhelper.co.uk/?s=test+doubles
What it has made me realise is that this is probably a technique rather than a toolkit/framework although I think some spy helpers should be easy to throw together at some point.
04-28-2015 02:31 PM
Yes, I remember this post. I understand the need to have a certain level of taxonomy but personally never held myself accountable to enforcing any particular terms - I tend to through Mocks around a lot.
I started thinking again on a version of a Mock framework that scripts up Mock classes based on the provided test class. My current line of thinking it that it overrides all dynamic dispatch methods of the class under test and provides additional methods to stub the over-riden methods as well as to spy on interface calls. Since the interface is strongly-typed you still get the benefits of the compiler checks in your tests. This would only reasonably work as a compile-time construct - you could generate them at run-time but I imagine it would be horrendously slow.
Probably too many steps at once but I can forsee a great deal of use for such a framework.
11-19-2019 05:09 PM
I am really late to tthe party, but you all might find this useful.
https://gitlab.com/sas_public/class_refactoring_tools
There is a youtube video linked in the readme that explains everything.