Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

  1. You can continue to use PEX to generate tests by opening your solution(s) in VS 2010 , even if  you are normally working inside VS 2012. VS project schema is very compatible between VS 2010 and VS 2012. You also could consider to run command line PEX from 2010 add-in. See  https://stackoverflow.com/a/6809669

  2. PEX should work together with other mocking frameworks, not limited to Moles or Fakes, e.g see Integrate Pex with MoQ

  3. Fakes are now  available for VS Premium- see http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2919309-provide-microsoft-fakes-with-all-visual-studio-edi

  4. From a huge variety of mocking frameworks our team selected NSubstitute, and we are quite happy with it. 

  5. I am also not aware of an alternative to PEX for generating tests in .NET. However look at AutoFixture,  Both projects focus on auto-generating test input  "It would make sense to use a combination of AutoFixture and Pex by using AutoFixture for TDD, and then subsequently Pex for QA."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top