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

Mock.IsProfilerEnabled is false in Nant

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Emmsa
Top achievements
Rank 2
Emmsa asked on 19 Oct 2012, 01:52 PM
I have this target inside my build file

<target name="Test" description="Test" depends="Build">
      <loadtasks assembly="C:\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.NAnt.dll" />
      <justmockstart />
      <nunit2>
          <formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}" />
          <test assemblyname="Tests/bin/release/Tests.dll" appconfig="Tests/bin/release/Tests.dll.config">
              <categories>
        <exclude name="FIXME" />
      </categories>
          </test>
      </nunit2>
      <justmockstop />
 
</target>

1. The "loadtasks" task works fine
2. justmockstart says nothing
3. I have a test with the following assert:

Assert.IsTrue(Mock.IsProfilerEnabled, "Profile is enabled");

And it fails, so Shouldn't the task "justmockstart" enable profiling in my tests?

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 23 Oct 2012, 03:49 PM
Hi Dario,

 Thank you for contacting Telerik support.

 It is unfortunate to see that you are experiencing problems, integrating JustMock with Nant. However, to help you, we will need to investigate further in your issue.

 Here are several steps I would ask you to accomplish, so we can get the needed information:
  1. Go inside your code and into the test method you have:
    Assert.IsTrue(Mock.IsProfilerEnabled, "Profile is enabled");

    please add one of the following code blocks (it won`t be a problem if you add them both):
    Console.Error.WriteLine("ProcessID=" + System.Diagnostics.Process.GetCurrentProcess().Id);
    Console.Error.WriteLine("JUSTMOCK_INSTANCE=" + Environment.GetEnvironmentVariable("JUSTMOCK_INSTANCE"));
    Console.Error.WriteLine("COR_ENABLE_PROFILING=" + Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING"));
    Console.Error.WriteLine("COR_PROFILER=" + Environment.GetEnvironmentVariable("COR_PROFILER"));
    or:
    System.Diagnostics.Debug.WriteLine("ProcessID=" + System.Diagnostics.Process.GetCurrentProcess().Id);
    System.Diagnostics.Debug.WriteLine("JUSTMOCK_INSTANCE=" + Environment.GetEnvironmentVariable("JUSTMOCK_INSTANCE"));
    System.Diagnostics.Debug.WriteLine("COR_ENABLE_PROFILING=" + Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING"));
    System.Diagnostics.Debug.WriteLine("COR_PROFILER=" + Environment.GetEnvironmentVariable("COR_PROFILER"));
  2. After you have done this, you will need to get some kind of monitoring tool, that can show you the debug output of your system. I would recommend you, using:
    http://technet.microsoft.com/en-us/sysinternals/bb896647
  3. Once you have started monitoring you will also need to start your project
  4. On the debug viewer check for:   ProcessID=...
    JUSTMOCK_INSTANCE=...
    COR_ENABLE_PROFILING=...
    COR_PROFILER=...
  5. Open the Event Viewer and check if there is an event with "Event ID" = 1022. Take the ProcessID from the previous step and check if it`s connected with that event.

 I would ask you to send us the results of this procedure as follows:
  1. ProcessID=...
    JUSTMOCK_INSTANCE=...
    COR_ENABLE_PROFILING=...
    COR_PROFILER=...
  2. The event viewer log, about event with ID = 1022.

 Thank you for your cooperation in advance.

Kind regards,
Kaloyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Emmsa
Top achievements
Rank 2
Answers by
Kaloyan
Telerik team
Share this question
or