Hi. I try to run simple test with JustMock on build machine:
Mock.SetupStatic(typeof(ConsoleApplication1.MyClass));
Mock.Arrange(() => ConsoleApplication1.MyClass.GetNumber()).Returns(777);
Assert.AreEqual(777, ConsoleApplication1.MyClass.GetNumber());
The test failed with message:
«Telerik.JustMock.MockException: Profiler must be enabled to mock/assert target MyClass.GetNumber() method.»
Error Stack Trace:
Telerik.JustMock.Handlers.InterceptorHandler.Create(Object target, MethodInfo methodInfo, Boolean privateMethod)
Telerik.JustMock.MockContext`1.SetupMock(MockExpression`1 expression)
Telerik.JustMock.Mock.<>c__DisplayClass1`1.<Arrange>b__0(MockContext`1 x)
Telerik.JustMock.MockContext.Setup[TDelgate,TReturn](Instruction instruction, Func`2 function)
Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)
JustMockTestProject1.JustMockTest1.TestMethod1()
Messages from Event Viewer:
.NET Runtime version 4.0.30319.261 - The profiler was loaded successfully. Profiler CLSID: '{B7ABE522-A68F-44F2-925B-81E7488E9EC0}'. Process ID (decimal): 1044. Message ID: [0x2507].
.NET Runtime version 4.0.30319.261 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{D1087F67-BEE8-4f53-B27A-4E01F64F3DA8}'. HRESULT: 0x80070002. Process ID (decimal): 3028. Message ID: [0x2504].
My build environment:
Windows Server 2008 R2 Standard Service Pack 1
Team Foundation Server - Standard Edition
JustMock Version Q3 2012 (2012.3.1016.3)
To solve this problem I was trying:
Followed this instruction from next link: http://www.telerik.com/help/justmock/integration-code-activity-workflow.html.
But I couldn’t drop JustMockTestRunner activity to build template.
Then I added the text shown below to test project
<Import Project="C:\Program Files (x86)\Telerik\JustMock\Libraries\JustMock.targets" />
<Target Name="BeforeTest">
<JustMockStart />
</Target>
<Target Name="AfterTest">
<JustMockStop />
</Target>
Also I tried to modify workflow template in the way the next post adwises http://www.telerik.com/community/forums/justmock/general-discussions/setupstatic---mockexception-opps-there-were-some-error-intercepting-target-call.aspx#1259708
Also tried this http://www.telerik.com/community/forums/justmock/general-discussions/use-justmock-in-msbuild.aspx#2309253 and this http://www.telerik.com/community/forums/justmock/general-discussions/profiler-must-be-enabled-error.aspx#2254776
So I don’t know what else I can do to run tests on the build environment.
Could you advise some decision?
Best regards,
Eugene Ozerov