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 ?
Please sign in to leave a comment.
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:
But you can clarify the variables with Telerik Support. Please let me know how it goes or if you have any other questions.
Yes it works. Thank you !
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?
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!
Thanks, I'll try it (set it up already, but currently don't have any tests to try it with).
I have been trying to set it up in order to make dotCover work. But I cannot.
I have followed the steps mentioned above and they work for running the unit tests normally, but not when checking their coverage.
Initially I got the error message mentioned above “The profiler must be enabled to mock, arrange or execute the specified target.”
But after adding the Test Runner Environment variables, I get “Inconclusive: Test has not run”
--- EXCEPTION #1/3 [UnknownExitCodeException]
Message = “Process C:\Users\<USER FOLDER>\AppData\Local\JetBrains\Installations\Rider243\lib\ReSharperHost\TestRunner\net472\ReSharperTestRunner64.exe:50344 exited with code '-1'.”
ExceptionPath = Root.InnerException.InnerException
ClassName = JetBrains.ReSharper.UnitTestFramework.Common.Exceptions.UnknownExitCodeException
HResult = COR_E_EXCEPTION=80131500
--- EXCEPTION #2/3 [ProcessExitedUnexpectedlyException]
Message = “Test runner agent exited unexpectedly”
InnerException = “Exception #1 at Root.InnerException.InnerException”
StackTraceString = “a bit long to share here”
ExceptionPath = Root.InnerException
ClassName = JetBrains.ReSharper.UnitTestFramework.Common.Exceptions.ProcessExitedUnexpectedlyException
HResult = COR_E_EXCEPTION=80131500
Source = JetBrains.ReSharper.UnitTestFramework
--- EXCEPTION #3/3 [LoggerException]
Message = “Test runner agent exited unexpectedly”
InnerException = “Exception #2 at Root.InnerException”
StackTraceString = “a bit long to share here”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
I am unsure on why is that.
Hey Enrique, to troubleshoot this efficiently, I would suggest you create a new issue on our issue tracker with Rider logs:
Settings | Build, Execution, Deployment | Unit Testing | Test RunnerLogging Levelto TRACE;Help | Diagnostic Tools | Choose Trace Scenarios, enable theUnitTestingBackendtrace scenario thereSettings | Build, Execution, Deployment | Unit Testing | Test Runner | Logging Levelto OFF.Help | Diagnostic Tools | Choose Trace Scenarios