How to enable Telerik JustMock Profiler ?

Answered

Hi, I use Telerik JustMock for my unit tests (MSTests style) and I try to run them in Rider (2020.3.4) but I receive this error :

The profiler must be enabled to mock, arrange or execute the specified target.

In Telerik forum, I find this post : https://www.telerik.com/forums/rider-profiler-support 

Who said : If JetBrains Rider allows configuration before running the test you could enable the profiler and run the tests.

Is it possible in Rider ?

5 comments
Comment actions Permalink

Hello Francis,

Yes, it should be available with using Test Runner Environment Variables settings in Preferences | Build, Execution, Deployment | Unit Testing | Test Runner as is it mentioned in this Telerik post. As far as I am aware the recommended variables are:

  • name: JUSTMOCK_INSTANCE, value: 1
  • name: COR_ENABLE_PROFILING, value: 1
  • name: COR_PROFILER, value: {B7ABE522-A68F-44F2-925B-81E7488E9EC0}
  • name: COR_PROFILER_PATH_32, value: <JustMock Install Root>\Progress\Telerik JustMock\Libraries\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll
  • name: COR_PROFILER_PATH_64, value: <JustMock Install Root>\Progress\Telerik JustMock\Libraries\CodeWeaver\64\Telerik.CodeWeaver.Profiler.dll

But you can clarify the variables with Telerik Support. Please let me know how it goes or if you have any other questions.

1
Comment actions Permalink

Yes it works. Thank you !

1
Comment actions Permalink

Hi,

I tried to get JustMock working with Rider and xUnit.net.

However, the Exception ("The profiler must be enabled to mock, arrange...") is still thrown, even though I have configured the environment variables like in the Telerik post.

Here's an image of my configurations, the path to the dlls is also correct.

Is there anything else I'm missing?

Other infos: I'm running the EAP programm (JetBrains Rider 213.4293.18), using .NET 5 and C#.

Edit:

I just installed the current version of Rider (2021.2.1), and it seems to be working here. Should I create a new bug report for this?

Edit 2:

Sadly, this was just a coincidence because I had Visual Studio with the JustMock Extension running in the background. After closing Visual Studio, I couldn't run the tests anymore.
Is there some way to get these tests working without always running Visual Studio in the background?

0
Comment actions Permalink

Hi Christoph,

Please try setup environment variables globally, like it is described here or here

The "Environment variables" field on the screenshot is for variables passed to Rider's Test Runner only. Check This doc page for details on this.

Hope it helps, have a nice day!

0
Comment actions Permalink

Thanks, I'll try it (set it up already, but currently don't have any tests to try it with).

0

Please sign in to leave a comment.