Thursday, May 20, 2004

I finally took some time today to explore NMock with a collegue.  We wanted to unit test a .NET component that was consuming some COM interfaces.  This is difficult, since the instances we are dealing with are created by another process, and they are not createable outside that environment. “Mocking” allows us to create an object that looks and behaves like the desired component for a specific condition, as well as provide an indication if the object under test behaved in the expected way.

NMock provides a full framework for mocking, and works well with NUnit, a top-notch unit testing framework.  While seeing a great potential for usefulness and making unit testing less painful, I was sad to see that there are some issues that kept it from working in our case:

  1. Practically zero documentation - No official documentation, some ambiguous samples here and there.  You can use the jMock documentation to learn concepts, but NMock is hardly a transparent port to the CLR.
  2. Some issues with mocking interfaces - It doesn't seem to recognize inherited members.
  3. Some issues with COMInterop - This was what made #2 a show stopper.  It was trying to instantiate a COM object when all we wanted was to mock it.

We'll screw with it some more in the next week or so before giving up.  There seems to be much more recent code in SourceForge than is released.  Maybe some of the issues are fixed.

posted on Thursday, May 20, 2004 6:20:06 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
Related posts:
LinqToStdf now on CodePlex
Image Slicer for Deep Zoom in Silverlight 2
Silverlight limitations and Constrained Callvirt in IL
What are the generic Delegates in the framework for?
What is System.__Canon and why is it on my stack?
Adding support for .ashx-based views in ASP.net MVC
Tracked by:
"diet pill for thyroid problem" (diet pill for thyroid problem) [Trackback]
"hand crank dynamo" (hand crank dynamo) [Trackback]
"used car buying guide quebec" (used car buying guide quebec) [Trackback]
"bone jewellery" (bone jewellery) [Trackback]
"Swing Life away" (Swing Life away) [Trackback]
"star furniture" (star furniture) [Trackback]
"on off on round rocker switch" (on off on round rocker switch) [Trackback]
"Keflex lasix" (Keflex lasix) [Trackback]
"Cheddars Restaurant in Texas" (Cheddars Restaurant in Texas) [Trackback]
"alpine aire" (alpine aire) [Trackback]
"PLANE CRASH" (PLANE CRASH) [Trackback]
"Dumb Blonde Jokes" (Dumb Blonde Jokes) [Trackback]
"pictures of space" (pictures of space) [Trackback]
"arc plasma temperature air" (arc plasma temperature air) [Trackback]
"Car Valuation Software Korea" (Car Valuation Software Korea) [Trackback]
"Cancun Women" (Cancun Women) [Trackback]
"money money health health go2clickbank.com" (money money health health go2click... [Trackback]
"internet payroll solutions" (internet payroll solutions) [Trackback]
"ugg australia in vancouver" (ugg australia in vancouver) [Trackback]
"quilt hanger" (quilt hanger) [Trackback]
"park rapids resort" (park rapids resort) [Trackback]
"1-800 directory" (1-800 directory) [Trackback]
"omega psi phi fraternity songs" (omega psi phi fraternity songs) [Trackback]
"serpent Alchemy dragon lore" (serpent Alchemy dragon lore) [Trackback]
"sturgis web cam" (sturgis web cam) [Trackback]
"aggiungi sito" (aggiungi sito) [Trackback]
"personal injury lawyer virginia" (personal injury lawyer virginia) [Trackback]
"likable cameriera prostituta" (likable cameriera prostituta) [Trackback]
"naughty college girls gone wild" (naughty college girls gone wild) [Trackback]
"BODY FORTRESS GLUTAMINE" (BODY FORTRESS GLUTAMINE) [Trackback]
"lava lamps" (lava lamps) [Trackback]
"cascade locks" (cascade locks) [Trackback]
"DMAE Cream" (DMAE Cream) [Trackback]
"mini digital video player" (mini digital video player) [Trackback]
"the talon tallahassee community college newspaper" (the talon tallahassee commu... [Trackback]
Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):