Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Christopher Bennage

Our WPF book is now available!


An Introduction to Mocking

Ayende has published an excellent sceencast introduction to Rhino Mocks. If you are at least somewhat familiar with Test Driven Development (TDD), then I highly recommend that you watch it. 

Rhino Mocks is a mock object framework for TDD, and in case you don't know (I'll assume nothing), mock objects are a tool that enables you to test just one thing at time.  In other words, it helps keep the unit your unit tests.

Additionally, Ayende is a magician with ReSharper. I learned a lot about my under-utilization of ReSharper and I was already an enthusiast!

He does move fast and makes a couple of comments that might pass over your head if you don't know a little bit about mocking already (e.g., the explicit record and play model vs. implicit; something he talks about here.)
 


Published Apr 03 2007, 11:43 AM by Christopher Bennage
Filed under: ,

Comments

Derik Whittaker said:

Chris,

How does Rhino Mocks compare to NMock.  I am somewhat familuar with NMock, but have never even looked at Rhino Mocks.

Derik

# April 3, 2007 12:28 PM

Billy McCafferty said:

Rhino Mocks is strongly typed while NMock uses strings to invoke method calls.  Otherwise, IMO, they're very comparable.  But the strongly typed advantage that Rhino Mocks is huge.

# April 3, 2007 12:31 PM

Derik Whittaker said:

Oh, that could be very nice.  I will have to watch the screencast and give it a shot.  

Thanks,

Derik

# April 3, 2007 1:18 PM

Christopher Bennage said:

Ayende has a few sentences about what differentiates Rhino here:

http://ayende.com/projects/rhino-mocks.aspx

# April 3, 2007 2:34 PM

keith said:

one point i'd like to make, is that the real benefit of mock objects to me is for verifying program flow and object interaction (i.e. "make sure that a particular method is called with particular params, fail if that doesn't happen")

the idea of only running the code you want to test (i.e. "testing one thing at a time") is more of a concept of stubs, not mocks.

# April 3, 2007 3:19 PM

About Christopher Bennage

Christopher is a software developer and consultant at Blue Spire Consulting, a company he co-founded with Rob Eisenberg in 2006. He is a Christian, a marginal musician, and an armchair philosopher. His interests include programming, liberal education, science, truth, beauty, and a number of deceased British authors (C. S. Lewis, G. K. Chesterton, and most recently Owen Barfield.) He lives in Tallahassee, FL with his wife and three children and still prefers to play as the Night Elves in WarCraft 3. Check out Devlicio.us!

Our Sponsors

Red-Gate!