Telerik® JustMock™ by Progress

We recommend that you install JustMock on every machine that needs to enable the profiler for elevated mocking. However, we also know that this is not always possible. For example, you may want to run your builds on a shared hosting build server, which doesn't allow installation of third party software. In those cases, you can configure JustMock to activate the profiler without prior installation.

Prerequisites and caveats

.NET Framework 4 and up allow you to activate a profiler without it being installed in the registry beforehand. To do this, you need to specify the full path to the profiler DLL to the .NET runtime. Note that this has to be done before starting the profiled process!

There are limitations to using registry-free profiler activation:

  • You can't use it with .NET 2.0/3.5 test runners - only .NET 4 and newer are supported.

  • You must know the bitness of the test runner beforehand. If the test runner is a 32-bit process, then you must specify the path to the 32-bit profiler DLL. If the test runner is 64-bit, then you need to use the 64-bit profiler DLL.

After you choose the required bitness of the profiler, you must commit the respective profiler DLLs into your source control repository. You can find the profiler DLLs in the JustMock installation folder. The usual locations are:

  • 32-bit profiler - C:\Program Files (x86)\Telerik\JustMock\Libraries\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll

  • 64-bit profiler - C:\Program Files (x86)\Telerik\JustMock\Libraries\CodeWeaver\64\Telerik.CodeWeaver.Profiler.dll

Commit one or both DLLs to your source control repository. Do not rename them! If you need to use both, then commit them in separate folders. Your build system can then activate the profiler after checking it out from source control. The need to specify the full path to the profiler DLL means that you need to have a mechanism to resolve relative paths in source control to physical paths before trying to activate the profiler.

Installation-free integration with MSBuild

The <JustMockStart/> MSBuild task has the attribute ProfilerPath, which must be set to the full path to the profiler DLL. Usually there is a build variable that holds the absolute path to the source code root folder. If we assume that variable is called $(SourceDir) then we can set the profiler path like so:

CopyXML
<JustMockStart ProfilerPath="$(SourceDir)\path\to\Telerik.CodeWeaver.Profiler.dll" />

Installation-free integration with TFS Workflow Code Activities

Before proceeding with the steps to enable installation-free integration with TFS, you must first execute the steps for integrating the JustMock Code Activity into your build workflow.

Follow this article for detailed steps describing the Code Activity Workflow for TFS 2010 or TFS 2012, or check this page to integrate Telerik JustMock in TFS 2013.

The JustMockStart Code Activity has the ProfilerPath property, which must be set to the full path to the profiler DLL. Usually there is a build variable that holds the absolute path to the source code root folder. If we assume that variable is called SourcesDirectory then we can set the profiler path like so:

Code Activity Profiler Path

If you don't have a variable that holds the path to the sources, then you can create one by following these steps.

  1. Create a build variable called SourcesDirectory as shown on the following diagram:

    Code Activity Source Dir 0
    It should be of type String and scoped to "Compile, Test and Publish".

  2. When asked, specify String for the type of its generic argument:

    Code Activity Source Dir 2

  3. Configure the activity:

    Code Activity Source Dir 3
    • Set the Name property to WellKnownEnvironmentVariables.SourcesDirectory
    • Set the Result property to SourcesDirectory

Installation-free integration through the environment

Installation-free integration in the general case by setting the COR_PROFILER_PATH environment variable to the full path to the profiler DLL.

Execute the following shell command before executing JustMockRunner.exe or otherwise executing the command that runs the tests:

SET COR_PROFILER_PATH=C:\full\path\to\Telerik.CodeWeaver.Profiler.dll

Substitute the path to the correct path. How you do that depends on the specific build system you're integrating with.