mockingvisual-studio-2012molespex

Moving away from Pex and Moles in VS 2012?


When it comes to testing I've backed into it. I'm now a huge fan, and often do something like TDD. In VS 2010 for design and regressions I've just used MSTEST. This is great - all my projects are open source and connected to my work anyway (physics research @ university). I then got into Pex which helped a lot find all sorts of edge cases I'd not been looking for. In general, this has been a revolution in how I code. And this has introduced me to Moles. Also very cool (but I'm still learning).

Unfortunately, I have access only to the Pro version of VS (that is what my university gets as a site license). The result is that Moles no longer works, and the upgrade, Fakes won't either. And I would imagine that the next version of Pex will rely on Fakes, make it also an Ultimate-only option.

So, I find myself now looking for open source tools that have similar functionality. Is there an article somewhere or a resource that compares some of the more mature OSS projects out there? I find myself at a bit of a loss (i.e. too many options). While I love this mocking ability, it is a tool, and not what I want to spend my spare time playing with (which is where most of my .NET programming occurs).

I assume that Pex will be impossible to replace without spending real money.

And while I'm at it, it seems like perhaps I should look to see if there are other testing frameworks that are better than MSTEST. MSTEST is pretty good, but is starting to feel a bit limited (I've not explored any new features in VS2012, if there are any).

Thanks a lot for the help, in advance, and really, normally I try to ask a more specific question, but I'm a bit at sea here.


Solution

  • I am not aware of an alternative to PEX for testing in .NET.

    There are many alternatives to the Fakes framework, such as Moq or Rhino Mocks. See here for a more complete list. Personally I use Moq because I like the fluent API, and it supports both classical and mockist styles of testing.

    The Fakes framework also includes the ability to generate shims for types which are not unit test friendly (e.g. sealed types or static methods). TypeMock Isolator is probably the only alternative to this, but it is not free. Failing that you can write your own test friendly wrappers, or use some form of duck typing.

    Visual Studio 2012 has a plug in architecture for test runners, Peter Provst maintains a list of plugins here. I think VS 2012 now uses vstestconsole instead of MSTest, it certainly feels a lot faster running unit tests in 2012 than 2010. NUnit has better support for parameterized tests than MSTest.