This is a migrated thread and some comments may be shown as answers.

JustMock and Microsoft Fakes?

3 Answers 253 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 24 Nov 2013, 06:12 AM

I'm trying to understand if JustMock and Microsoft Fakes both have a place in the same project as complementary tools, or if it's a case of choosing one versus the other.

thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Kaloyan
Telerik team
answered on 26 Nov 2013, 11:29 AM
Hi Robert,

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
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Bob
Top achievements
Rank 2
answered on 16 Jul 2015, 05:16 PM

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?

0
Stefan
Telerik team
answered on 21 Jul 2015, 06:58 AM
Hello Bob,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Bob
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or