For those hard to mock moments - Microsoft Fakes or Typemock Isolator?
About a year ago I wrote a post ‘Now that VS11 has a fake library do I still need Typemock Isolator to fake out SharePoint?’. Well this discussion becomes relevant for more people as with Visual Studio 2012.2 (currently available as a CTP) the Microsoft Fakes move from the Ultimate SKU to the Premium SKU.
From my experience the Ultimate SKU is not present on too many developer’s PCs. It is most commonly found on the PCs of the team leads, software architects or test developers (managing coded UI/load testing etc. efforts). If a team was historically going to use Microsoft Fakes then they had to buy more Ultimate SKUs; as what is the point of a unit test using a mocking framework that only part of the team can run?
The Premium SKU of Visual Studio is far more common, I would go as far as to say it is the corporate standard for development. Now as this SKU contains Test Manager (since 2012 RTM) it covers most jobs most developers do. Ultimate is just needed for the specialists in the team. Adding fakes to the Premium SKU really makes sense if Microsoft want to drive adoption.
So now the question of whether to use Microsoft Fakes or Typemock Isolator (or Telerik JustMock a product I have to admit I have not used in anger) is rebalanced as there is a fair chance a development team may all be licensed for Microsoft Fakes as they have the premium SKU. The question becomes is the cost of Isolator justified by the features it offers over and above Microsoft Fakes?
This is not an uncommon form of question for any third party add-in to Visual Studio. Visual Studio offers refactoring, but I think few would argue that Resharper or RefactorPro! don’t offer more features that justify their cost.
For me the big advantage of Typemock is ease of use and consistent syntax across all usage patterns. This could be just due to familiarity, but the fact I don’t need to manually generate the fake assembly is a bonus. Also that Isolator’s fluent API is basically the same as Moq and FakeItEasy so causes less friction when coming to advanced mocking from these tools. A team can use the free basic version of Typemock Isolator until they need the advanced features when they need to license it.
Fakes is a different way of working to most other frameworks, working at a different level inside Visual Studio. A disadvantage of this is that it does not lend itself well to refactoring, you are probably going to have to regenerate the fake assemblies after any refactor, which can be slow. Also this makes refactoring a bit more risky, as you also have to touch unit tests, a manual operation.
I think at this time for me Isolator still offers advanced features and easy of use advantages that justifies the license cost. However, as with all tools this is an ever changing field, I expect to see new features and changes for all the players in the fakes market as they all aim to better address the problems cause by the poorly architecture of applications/frameworks such as SharePoint and of course our own poorly designed legacy code.