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

Is JustMock only a mock, not a run time AOP?

4 Answers 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ying
Top achievements
Rank 1
Ying asked on 02 Aug 2010, 03:43 PM
I watched the video of JustMock. I am surprised for what JustMock can do. Actually I immediately thought it could be a run time AOP. But then I read the following words about JustMock:
"This approach (Profiling API) is quite powerful but has its own disadvantages like the hard deployment. You need to have it integrated with your Visual Studio and also with your testing framework and also in some cases its performance is worse compared to how the dynamic proxy approach works." (Digested from http://www.telerik.com/community/forums/justmock/general-discussions/is-justmock-a-quot-profiler-quot.aspx ).

But in http://msdn.microsoft.com/en-us/magazine/cc188743.aspx , it is said Profiling API 
" not suited for deployment in a production environment. The reason is that it's based on the Profiling API, which after being registered circumvents the CLR security infrastructure. Plus it prevents use of other profilers which are seeking to perform real performance analysis on the app."

It seems in theory, JustMock can be used in a standalone application, out of visual studio.

So, I have related questions for Telerik to confirm:
1. Does JustMock library only run when it is integrated with Visual Studio?
2. Is there a way to run it at run time in a standalone application?
3. Does Telerik have a plan to make it an AOP, not only a mock?

Thank you in advance,

Ying

4 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 03 Aug 2010, 10:45 AM

Hello Ying,

Thanks for making such query. Jumping directly to your questions:

1.  Does JustMock library only run when it is integrated with Visual Studio?

=> No.  It can run with or without the visual add-in. But if you are not using with the JustMock profiler addin , then you will only be able to mock virtual members. This is the goodness of Justmock’s Dual architecture.

2. Is there a way to run it at run time in a standalone application?

=> Yes it is possible. But we recommend that this is a test tool and should not be used in production. However, In standalone .net application you can just set the profiler manually or if you are using Silverlight where you don’t have profiler available then you can just use the inheritance features (Ex. Mocking virtual members). Additionally, JustMock can also run as a standalone DLL but in that case you won’t be having any profiler related features.

3. Does Telerik have a plan to make it an AOP, not only a mock?

=> AOP generally comes with dynamic proxy like PostSharp / Castle dynamic proxy. It is better combined with dynamic proxies than with mocking tool.  At some point we do have a plan to extend the dynamic proxy that we have for JustMock to further enhance it into AOP tool.

 

With Regards,
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items
0
Mihail
Telerik team
answered on 03 Aug 2010, 12:39 PM
Hello Ying,

I would like to provide addition information how to enable JustMock profiler mode without Visual Studio. Basically you have to set two environment variables (COR_PROFILE and COR_ENABLE_PROFILING). For more information you can read MSDN article http://msdn.microsoft.com/en-us/library/s5ec0es1(VS.80).aspx

JustMock profiler GUID is {D1087F67-BEE8-4f53-B27A-4E01F64F3DA8}. For .NET 4.0 you have to set COMPLUS_ProfAPI_ProfilerCompatibilitySetting variable as well (read more at http://blogs.msdn.com/b/davbr/archive/2009/05/26/run-your-v2-profiler-binary-on-clr-v4.aspx)

I would not recommend setting these variables at global/system level. It is better to use batch files instead or to set the variable for a particular process only.


Best wishes,
Mike
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ying
Top achievements
Rank 1
answered on 03 Aug 2010, 01:12 PM
Thank you very much.

I have one related question. For most AOP functions, the modified assemblies can be save to disk and avoid AOPing again for the same aspect in the next time. Is it ready for JustMock? I couldn't find any evidence.

BTW, Postsharp is not using Proxy to do AOP. Instead it uses Load-Time Static Weaving. You may find more information on http://www.sharpcrafters.com/aop.net/runtime-weaving.

Ying


0
Ricky
Telerik team
answered on 03 Aug 2010, 03:47 PM
Hello Ying,

Unfortunately what could be done with tools like PostSharp, can't be done with JustMock because these tools use totally different approaches. While PostSharp uses static weaving (they're modifying the assembly), JustMock's code weaver uses dynamic weaving and modifies the IL code at run time. The changes that JustMock does can't be saved back in the assembly.
To do that you could either use PostSharp or you could even try Mono.Cecil (http://www.mono-project.com/Cecil).
Hope this helps.

Best wishes,
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ying
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Mihail
Telerik team
Ying
Top achievements
Rank 1
Share this question
or