Moving away from Pex and Moles in VS 2012?
Asked Answered
Q

2

7

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.

Quince answered 24/11, 2012 at 1:50 Comment(1)
nunit and xunit are great alternatives to MSTests. xunit even supports async tests nowCalorimeter
T
4

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.

Trevortrevorr answered 24/11, 2012 at 20:34 Comment(2)
Yes. I will miss the ability to do shims, something I was just learning how to do.Quince
Fakes is the release version of Moles. Pex still may have a future. It makes sense that Moles should come to market first, and iron out all of the wrinkles. Pex may make an appearance in the next major release. I have not heard anything about this; this is conjecture only.Endothelioma
P
5
  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."

Postpaid answered 15/6, 2013 at 7:31 Comment(0)
T
4

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.

Trevortrevorr answered 24/11, 2012 at 20:34 Comment(2)
Yes. I will miss the ability to do shims, something I was just learning how to do.Quince
Fakes is the release version of Moles. Pex still may have a future. It makes sense that Moles should come to market first, and iron out all of the wrinkles. Pex may make an appearance in the next major release. I have not heard anything about this; this is conjecture only.Endothelioma

© 2022 - 2024 — McMap. All rights reserved.