MS Stubs framework

A colleague of mine recently came across Stubs – a Lightweight Stub Framework for .NET and suggested I take a look. Having used both Moq and Rhino Mocks in the past, I was intrigued, and thought I should take a closer look.

I may have gotten the wrong end-of-the-stick, but it seems that Stubs uses code-generation to generate stubs, rather than the more typical dynamic code approach used by other frameworks (reflection and expression trees).

My initial thoughts are:

  • I wonder how well the code-gen approach works with TDD? I don’t fancy having to re-run a tool manually every time I create a new interface; the less friction the better!
  • I generally would tend to favour dynamic code (reflection, expression trees etc) over code-gen unless performance is a key-factor, since this results in less code to maintain. It may be the case that code-gen here can make a significant reduction in execution time of tests in larger code-bases, although it would be interesting to see some stats for this. It would also be interesting to see whether this approach works out favourably on a long-running project (where interfaces are likely to change) as I can see maintenance of the stubs being a potential issue.
  • It’s good to see Microsoft favouring type-safe code rather than using magic strings as they had in other projects (like asp.net MVC)

 

I seems like this could be an interesting project to keep an eye on, but for the mean-while at least, I think I’ll stick to Rhino Mocks!

0 Responses to “MS Stubs framework”



  1. No Comments Yet

Leave a Reply