Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone using Moles / Pex in production?

I did search the forum and did not find a similar question. I'm looking to make a final decision on our mocking framework of choice moving forward as a best practice - I've decided on Moq... untill I just recently discovered MS has finally created a mocking framework called Moles which seems to work similar to TypeMock via the profiler API sexyness etc..

There's a million 'NMock vs Moq vs TypeMock vs Rhino....' threads on here. But I never see Moles involved.In fact, I did not even know if its existence until a short time ago. Anyone using it? In Production? Anyone dump their old mocking framework for it, and if so, which one? How did it compare to ther mocking frameworks you've used?

thanks.. ps, we are using VS2008 and are moving to 2010 shortly.

like image 538
dferraro Avatar asked Mar 16 '10 15:03

dferraro


2 Answers

I am in the same scenario you are in , so I'd like to comment on my experiences.

Both Typemock and Moles have the goal of isolation in mind. Especially for those pesky sealed classes, non-virtual methods.

I believe an isolation framework, as ones mentioned above, are needed especially if you are in the later phases of development and/or have no/little control of the code base.

These are the advantages in Typemock, I have not yet discovered with Moles

  • Support for code coverage tools ( Ncover and Partcover )
  • Support to intercept/verify on privates (methods / properties) [yes this is controversial]
  • More polished product, up and running fast with intuitive API (still messing with Moles to even work right)

I hope Moles matures into released product, but the beginning of my tinkering with it seems to be no different than other MS Research projects; usually unpolished, but that seems to be the nature of those type of projects.

like image 136
RyBolt Avatar answered Nov 05 '22 03:11

RyBolt


I think moles are taking mocking to the next level, it's much more powerful.

What do you mean by 'in production'?. Moles are only useful in unit testing. It has a serious performance impact and it also allows unsafe code in production (ever thought about replacing an IsAuthorized function to return true?).

Moles are usable in both 2008 and 2009.

Hope this answers your question.

like image 7
Gerrie Schenck Avatar answered Nov 05 '22 02:11

Gerrie Schenck