Telerik® JustMock™ by Progress

This topic will show you an example including some code samples which can guide you through the process of running the Just Mock profiler outside Visual Studio.


Telerik JustMock integrates with Visual Studio 2008 and 2010 as well as with other third-party code coverage tools, profilers, and unit testing add-ins. Look at the Integration topic to learn more.


This feature is available only in the commercial version of Telerik JustMock.

Refer to this topic to learn more about the differences between both the commercial and free versions of Telerik JustMock.


To take the advantage of the profiler intensive tests, Telerik JustMock full edition must be installed which actually registers the profiler.


The following example will run Telerik JustMock using nunit console. You fist need to set the profiling variable correctly and then run it as a child process. Mocking concrete methods works by initializing the .NET profiler that is set using two variables in the runtime. These variables let JustMock work in a correct way.


  • COR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0}

In addition, it sets the COMPLUS_ProfAPI_ProfilerCompatibilitySetting to EnableV2Profiler in order to mock .NET 3.5 test projects. Also, sets JUSTMOCK_INSTANCE variable with the current process ID.

To simplify the following steps you can look at this code sample.

While running msbuild or nunit console or standalone GUI tool, initialization is not always as easy as expected. Therefore you can use the JustMockRunner.exe to help you with the initialization. From version Q1 2012 it is included in the Telerik JustMock installation /Libraries folder. If you are using an older version of Telerik JustMock you can find the JustMockRunner.exe included in this code sample . Basically the JustMockRunner.exe lets you pipe your test DLL containing the tests with JustMock. All you have to do is to create a batch file where you will pass the path to the runner and the test DLL in the following format:

JustMockRunner.exe "%Path to test runner%\nunit-console.exe” "%PathToDir%\JustMockTrialTests.dll"

Once the bat is executed, in this case it will open up the console, run the tests and print result from the test runner.

RunningJMProfiler OutsideVS
Figure 1: Executing tests outside Visual Studio

To take advantage of this sample you should have the commercial version of Telerik JustMock. Also, please build the test project (output DLLs are removed) before running Run.bat

JustMockRunner.exe in this sample is piped with nunit-console.exe. If you need to superset the whole thing with PartCover, thre are a couple of things you should do. In your PartCover configuration you need to mention the target starting with JustMockRunner:

JustMockRunner.exe "%Path to test runner%\nunit-console.exe”

Followed by the target test assembly that should look like:


Here please note the Quote(""), that is required by JustMockRunner. For configuring PartCover with the nunit console you might also like to take a look at this.


Note that when you use JustMockRunner.exe to run the profiler outside Visual Studio, Telerik JustMock will dynamically load the correct version of the System.Web.dll(3.5 or 4.0) from the current domain.

See Also