Thursday, May 26, 2005

"Mock Objects" - Great Unit-Testing Technique

Today I learned how to use "mock objects", which are a super-easy way to create fake objects for testing. You barely have to write any code - just tell the DynamicMockObject what values to return for what method names.

Update: I must say that NMock is better than DotNetMock. Better documentation, more tutorials, more flexible specification of values (IsAnything), rules can be relaxed (SetupResult).

2 comments:

  1. Mock objects rock!
    I recently started using EasyMock in my JUnits, now I don't think I can do without!

    ReplyDelete
  2. Hi Erik - Thanks for the EasyMock recommendation.

    ReplyDelete