3 Answers, 1 is accepted
Thank you for bringing this question.
I can not think of a scenario where both tools help each other. As the integration between them is possible, I believe, you should choose only one of them and stick to it. Otherwise, you will introduce two completely different approaches of doing the same thing (different workflows and different syntax), which can lead to a lot of overhead.
I made a little investigation and managed to find the main differences between both JustMock and Mickrosft Fakes:
- Fakes statically creates shims and stubs of the mocked members while JustMock instruments them dynamically with its profiler. As Fakes can be a bit faster, the disadvantages are that the shims/stubs are put in a different library which must be referred to the test project. Also, any refactoring to the system under test won't be applied to this library automatically.
- In JustMock, we have implemented a lot of features that should help you write faster and cleaner unit tests (e.g., CreateLike, Matchers, Occurs, Sequential mocking, automocking, etc...). In Fakes you have to implement this logic by yourself with code inside the arrangements.
- JustMock provides support for mocking inside Silverlight runtime, and mocking DllImport, which I was not able to find in Fakes.
- If you have Visual Studio Premium or above, Microsoft Fakes comes free with it. The JustMock license for its commercial version is paid.
As final words, I would recommend you to try both and see for yourself which suits you most and which satisfies your needs best. Then, you should know if both tools have place in the same project :).
I hope this had helped you.
Regards,
Kaloyan
Telerik
I understand that it would be best to choose one over the other, but my team has integrated Microsoft Fakes in several of our projects before we started using Telerik. Now that we have Telerik DevCraft Complete, and have learned about the strengths of JustMock, we would like to move to using only JustMock, but we have too many tests using Fakes to convert all of them at once.
The problem is that now that we have a couple of projects using JustMock, none of our tests with the Fakes framework work due to Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to get address of function SetDetourProvider from library 'C:\Program Files (x86)\Telerik\JustMock\Libraries\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll'.
We can't afford an all or nothing approach here. Do you have a way to use both on the same build server?
The recommended approach here is to split the test assembly in two - one old with all the Fakes tests and one new with all JustMock tests. You can gradually migrate your tests from the former into the latter, or not at all. You'll then enable the JustMock profiler only for the latter test run and leave if off during the former.
We will investigate if there is a way to integrate JustMock and Fakes for a seamless experience, but I don't think this would be a priority for us, as JustMock and Fakes are not complementary products - you essentially use one or the other and never both within a single test project.
Regards,
Stefan
Telerik