nav-left cat-right

.Net Mocking Frameworks – Capability Comparison

I have a couple years of experience of TDD under my belt, but it's only recently that I've felt like I am a relatively decent practitioner of it.  I attribute this to forcing myself to take the plunge into mocking, and the knowledge of patterns and loosely-coupled design that I've gained from it.

You see, I work on a pretty large and complex ASP.Net webforms product, and tests were introduced late into the development cycle of the initial release.  We favored integration testing with real data sources over actual unit tests. While I did write some tests, I knew that our product was not very testable by design.

Recently we put together a public facing API for programming against the product, that we were able to build from scratch.  This was a natural opening to apply test driven practices and start building unit tests from the get-go.  Due to the service oriented nature of the data that the product consumes, I soon found myself realizing that I needed mocks in a big way.  I gritted my teeth and dove head-first into Rhino.mocks.

Several weeks down the road, it was obvious that Rhino just isn't right for our environment.  The learning curve is too steep to win quick success with all our developers (and therefore by extension, our project managers).  I began looking for another framework.

This led me on a frustrating research mission to find the differences between frameworks without actually trying them all. Due to a lack of in-depth comparisons of the actual capabilities of the various mocking frameworks, I've ended up putting together this chart.  I'm hoping it helps some people.  My interest is very high in this arena, so I will be keeping it up to date.

(Just for interest's sake -- we ended up choosing Moq, due to the ease of the API.   The philosophy of Moq jives perfectly with our relatively fast-paced and efficient development environment.  We don't care about purism -- we care about getting it done.)

.Net Mocking Framework Comparison

.Net Mocking Framework Comparison

Other Notes


  • Mature, flexible framework
  • Built on Castle DynamicProxy
  • Very large array of "syntaxes" leads to extreme confusion when writing tests -- documentation mixed for the new 3.5 fluent syntax
  • Large community of users

  • New(ish) framework also built on Castle
  • Requires .Net 3.5 due to its lambda heavy syntax
  • No distinction between mocks & stubs, record/playback (joy!!)
  • Responsive and active developers and community

  • Uses "magic strings" for mocking -- makes tests brittle
  • Confusing product version #'s -- Nmock2 is actually a new team that picked up NMock and continued development

  • Powerful framework that uses redirection at the IL level to create mocks
  • Expensive ($450/license)
  • TDD Purists argue that the power of it leads to poorer design

The above observations were gleaned from many web pages, documentation repositories and blog posts, and reflect my limited understanding of each framework.   There may be errors.  If you think I'm wrong, or you can think of other capability aspects that I've overlooked, please let me know!

kick it on

Be Sociable, Share!

7 Responses to “.Net Mocking Frameworks – Capability Comparison”

  1. Nice comparison! Thanks for this post.

    Some additions to NMock2:
    – "confusing product version": sad but true, we continue to develop NMock2 (with the 2 in the name). NMock2 is based on NMock version 2 (2 in the version number). Unfortunately, we cannot convince the "old" NMock team to link their pages to our version. The current version can be found at

    – support for events: you mark it as partial support. What do you miss?

    – class mocks: this is a new feature of our current release candidate, only.

    – "callback on mocked method": this is support with actions (e.g. DelegateAction) in NMock2.

    – "magic strings": it is true that that makes refactoring a bit more complex. However with the right toolset (e.g. ReSharper) we don't have problems with that. And from a pure TDD point of view, you should change your unit test first ;-)
    these magic strings have advantages and disadvantages: the disadvantage is clear, no compile time check, no intellisense support; the advantage is the flexibility we get: our syntax is not limited to what you can express in C#, what results in the easiest syntax to read (compared to the other frameworks). And if you do TDD then you read your unit tests more often than you write them.

    Other things to compare:
    – documentation, although we are very bad regarding this ;-)
    – understandability of error messages: here we are very good, I think
    – performance: not crucial but important, too

    But, as long as developers do use a mocking framework (which ever) it's a good sign :-)

    Happy mocking

  2. morgan says:

    Urs –

    Thanks for the reply. I marked the event support as partial because all I could find on events with NMock2 was some posts that showed workarounds for raising events. Same with callbacks. It might have been NMock I was looking at. Of course now that you point it out, I found in the documentation how to do it, so looks like no problems there. I'll update the chart asap.

    When you say NMock2 now supports mocking classes, do you mean non-virtual members of a class as well?

    Documentation was something I considered adding, but it's a little subjective. I think lots of people feel that Rhino is well documented, where I (being a relative noob) don't agree with that :) Understandability of error messages may be something I add to the chart though, as this is often brought up as a failure of Rhino, which seems like a valid criticism.

  3. […] .Net Mocking Frameworks – Capability Comparison A nice comparison of popular .NET mocking frameworks. Good information to have. […]

  4. Hi Morgan,

    Great work on the comparison. By the way did you see Andrew Kazyryevitch comparison? (

    Just to update your table, we support callbacks now. And if you'e like to see the comparison we did, email me at Gilz at typemock dot com.


    Gil Zilberfeld

  5. morgan says:

    Thanks Gil. I hadn't seen A.K.'s project but I'm glad you posted it. Looks extremely useful.

    I'll update the chart.

  6. […] a bit of research I decided on using Rhino Mocks. The decision was primarily made from examining this comparison and my past experiences with Ayende. I have previously used Fluent NHibernate from Ayende, and was […]

  7. […] I played with some mocking frameworks in .Net. There are already some comparisons available (here, here or here). In this blog post I want to show which frameworks are available and which one fits best […]

  8. […] Moq and some are commercial such as TypeMock . Here are two links that compare few of them and . Frankly speaking, I first […]

  9. […] Capability comparison made by Morgan Soley. Half year old but with a feature comparison table. […]

  10. We offer exceptional ustomer support to clarify any kind of customers.

    But the ones that succeed if you search it out, are the ones who went in with a good solid business plan.
    Though our site contains information on top boody cleansing diet plans, we mistly prefer Isagenix,

  11. I've been browsing online more than 4 hours today, yet I never found any interesting
    article like yours. It is pretty worth enough for me.

    In my opinion, if all website owners and bloggers made good content as you did, the internet
    will be a lot more useful than ever before.|
    I couldn't resist commenting. Perfectly written!|
    I'll right away grab your rss as I can not to find your email subscription hyperlink or newsletter service.
    Do you have any? Please allow me understand in order that I may subscribe.
    It is the best time to make some plans for the future and it's time to be happy.
    I have read this post and if I could I desire to
    suggest you some interesting things or advice. Perhaps you could write next articles referring to this article.
    I wish to read more things about it!|
    It is perfect time to make a few plans for the future and
    it is time to be happy. I have read this put up and if I may just I want to suggest you some attention-grabbing issues or advice.

    Maybe you could write subsequent articles relating to this article.
    I desire to read even more things approximately it!|
    I've been surfing online more than 3 hours
    lately, yet I never discovered any attention-grabbing article like yours.
    It's pretty value sufficient for me. In my opinion, if
    all website owners and bloggers made excellent content material as you
    did, the internet will likely be a lot more helpful than ever before.|
    Ahaa, its good conversation on the topic of this article here at this weblog, I have read all that,
    so now me also commenting here.|
    I am sure this piece of writing has touched all the internet viewers,
    its really really fastidious paragraph on building up new web site.|
    Wow, this post is nice, my younger sister is analyzing these things,
    so I am going to let know her.|
    bookmarked!!, I like your website!|
    Way cool! Some extremely valid points! I appreciate you penning this write-up plus the rest of
    the website is extremely good.|
    Hi, I do think this is an excellent blog. I stumbledupon it ;)
    I will come back once again since i have book marked it. Money and
    freedom is the best way to change, may you be rich and continue to help
    Woah! I'm really digging the template/theme of this site.
    It's simple, yet effective. A lot of times it's
    difficult to get that "perfect balance" between superb usability and visual appeal.

    I must say you have done a awesome job with this. Also, the blog loads very fast for me on
    Firefox. Exceptional Blog!|
    These are genuinely fantastic ideas in regarding blogging.
    You have touched some pleasant points here. Any way keep up
    Everyone loves what you guys tend to be up too. This kind
    of clever work and exposure! Keep up the very good works
    guys I've incorporated you guys to our blogroll.|
    Hello! Someone in my Facebook group shared this site with us so I came to take a look.

    I'm definitely loving the information. I'm bookmarking and will be tweeting this to
    my followers! Great blog and fantastic style and design.|
    Everyone loves what you guys are up too. This type of clever work and reporting!

    Keep up the good works guys I've incorporated you guys to my blogroll.|
    Hey there would you mind sharing which blog platform you're using?
    I'm looking to start my own blog in the near future
    but I'm having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design seems different then most blogs and I'm looking for
    something unique. P.S Sorry for getting off-topic but I had to ask!|
    Hey would you mind letting me know which webhost
    you're working with? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good web hosting provider at a honest price?
    Thank you, I appreciate it!|
    I like it when individuals get together and share views.

    Great site, continue the good work!|
    Thank you for the auspicious writeup. It in fact was a amusement account it.

    Look advanced to more added agreeable from you! However, how
    can we communicate?|
    Hello just wanted to give you a quick heads up.
    The words in your article seem to be running off
    the screen in Chrome. I'm not sure if this is a format issue or something to do with internet browser compatibility but I figured I'd post to let you know.
    The style and design look great though! Hope you get the problem fixed soon.
    This is a topic that's close to my heart… Thank you!

    Where are your contact details though?|
    It's very straightforward to find out any topic on net as compared to books, as I found this article at this website.|
    Does your site have a contact page? I'm having problems locating
    it but, I'd like to shoot you an email. I've got some recommendations
    for your blog you might be interested in hearing.

    Either way, great site and I look forward to seeing it develop
    over time.|
    Hey there! I've been following your website for a long
    time now and finally got the courage to go ahead and give
    you a shout out from New Caney Tx! Just wanted to mention
    keep up the great job!|
    Greetings from Ohio! I'm bored to death at work so I decided to browse your website on my iphone during lunch break.
    I enjoy the info you present here and can't wait to take a look when I get home.
    I'm shocked at how fast your blog loaded on my cell phone
    .. I'm not even using WIFI, just 3G .. Anyways, great site!|
    Its like you learn my thoughts! You seem to know
    so much about this, such as you wrote the guide in it or something.
    I think that you just can do with a few p.c. to force the message house a little bit,
    but other than that, this is wonderful blog. A fantastic read.
    I'll definitely be back.|
    I visited various blogs except the audio feature for audio songs existing at this website is actually excellent.|
    Howdy, i read your blog occasionally and
    i own a similar one and i was just curious if you get a
    lot of spam feedback? If so how do you reduce it, any plugin or anything you can recommend?
    I get so much lately it's driving me insane so any support is
    very much appreciated.|
    Greetings! Very useful advice in this particular post! It is the little changes which will make the most important changes.
    Thanks a lot for sharing!|
    I seriously love your site.. Pleasant colors & theme. Did you build this
    web site yourself? Please reply back as I'm trying to create my own personal site and would love to learn where you got this
    from or just what the theme is called. Kudos!|
    Hello there! This article couldn't be written any
    better! Looking through this post reminds me of my previous roommate!
    He always kept preaching about this. I most certainly will send this
    article to him. Pretty sure he'll have a great read. Many thanks for sharing!|
    Amazing! This blog looks exactly like my old one! It's on a totally different topic but it has pretty much the same layout and
    design. Excellent choice of colors!|
    There is definately a lot to learn about this topic.
    I love all the points you made.|
    You have made some really good points there. I checked on the internet for additional information about the issue
    and found most people will go along with your views on
    this website.|
    Hi there, I check your blog regularly. Your writing style is witty, keep doing what you're doing!|
    I just couldn't leave your site prior to suggesting that I really enjoyed the usual information an individual
    supply in your visitors? Is gonna be back incessantly to check
    out new posts|
    I needed to thank you for this wonderful
    read!! I definitely enjoyed every bit of it. I have got you book marked to look at new
    things you post…|
    Hi there, just wanted to tell you, I loved this article.
    It was practical. Keep on posting!|
    I leave a response each time I like a post on a website or
    I have something to valuable to contribute to the discussion.
    Usually it's a result of the sincerness communicated in the post I browsed.
    And on this post .Net Mocking Frameworks – Capability Comparison | PHP vs .Net.
    I was excited enough to drop a comment :-P I actually do have 2 questions for you if it's allright.
    Could it be simply me or does it look like like some of these comments look like left by brain dead folks?

    :-P And, if you are posting at other social sites, I would like to follow everything new you have
    to post. Could you list every one of your shared pages like your Facebook page, twitter
    feed, or linkedin profile?|
    Hello, I enjoy reading through your article post. I like to write
    a little comment to support you.|
    I always spent my half an hour to read this web site's articles or reviews everyday along with a cup of
    I always emailed this webpage post page to all my friends, since if like to read it
    afterward my friends will too.|
    My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he's tryiong none the less. I've been using Movable-type on various websites
    for about a year and am nervous about switching to another
    platform. I have heard excellent things about
    Is there a way I can import all my wordpress posts into it?
    Any help would be really appreciated!|
    Hi! I could have sworn I've visited this site before but after
    browsing through some of the posts I realized it's new
    to me. Anyways, I'm definitely happy I came across
    it and I'll be bookmarking it and checking back frequently!|
    Great work! That is the type of info that are supposed to be shared across the internet.
    Shame on the search engines for now not positioning this publish
    higher! Come on over and visit my site . Thanks =)|
    Heya i'm for the first time here. I found this board and I find It really useful
    & it helped me out a lot. I hope to give something back and aid others like you aided me.|
    Hello, I do think your site could be having web browser compatibility problems.
    When I look at your blog in Safari, it looks fine however when
    opening in I.E., it has some overlapping issues. I simply wanted to provide you with a quick heads up!
    Aside from that, fantastic site!|
    Somebody essentially help to make critically articles I would state.
    This is the first time I frequented your website page
    and thus far? I amazed with the research you made to make
    this particular post extraordinary. Magnificent activity!|
    Heya i'm for the primary time here. I found this board
    and I in finding It really useful & it helped me out much.
    I am hoping to offer something back and aid others like you aided me.|
    Howdy! I simply would like to give you a big thumbs up for your excellent information you've
    got right here on this post. I will be returning to your blog for more soon.|
    I all the time used to study article in news papers but now as I am a user of internet so from
    now I am using net for articles, thanks to web.|
    Your mode of describing all in this article is truly nice, every one be capable of effortlessly understand it,
    Thanks a lot.|
    Hi there, I discovered your web site by way of Google at the same
    time as looking for a related subject, your website got here up, it looks great.

    I have bookmarked it in my google bookmarks.
    Hi there, simply turned into aware of your weblog through Google,
    and found that it's really informative. I'm gonna watch
    out for brussels. I'll be grateful when you proceed this in
    future. Many folks will likely be benefited from your writing.

    I'm curious to find out what blog system you are using?
    I'm having some minor security issues with my latest website and I'd like to find something more safeguarded.
    Do you have any recommendations?|
    I am extremely impressed with your writing skills and also
    with the layout on your blog. Is this a paid theme
    or did you customize it yourself? Anyway keep up the excellent quality writing, it is rare to see a great blog like this one these days.|
    I'm really inspired together with your writing talents and also with the layout to your weblog.
    Is that this a paid subject or did you modify it your self?
    Anyway stay up the excellent high quality writing, it's rare to see a great blog like this
    one nowadays..|
    Hello, Neat post. There is an issue together with your site in internet explorer, may test this?
    IE nonetheless is the marketplace chief and a good part of people will leave out your excellent writing because of this problem.|
    I'm not sure where you're getting your info, but good topic.
    I needs to spend some time learning more or understanding more.
    Thanks for magnificent info I was looking for this info for my mission.|
    Hi, i think that i saw you visited my weblog thus i came to “return the favor”.I am attempting to find things to improve
    my web site!I suppose its ok to use {some of|a few\

  12. xplocial says:

    Hi, always i used to check web site posts here in the early hours
    in the break of day, because i like to find out more and more.

Leave a Reply