From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Unit Testing Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Mock Objects - Any Success?

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.

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 11 of 13
(1,512 Views)

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.

0 Kudos
Message 12 of 13
(1,512 Views)

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.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 13 of 13
(1,052 Views)