In this article you will get familiar with Telerik JustMock Profiler built-in log and trace capabilities. Elevated mocking is strongly relies on profiler and sometimes it might be blocked by unexpected behavior which is hard to be troubleshooted. Here comes the profiler trace, it is really useful for finding where the problem comes from.
The log and trace functionality is controlled entirely via environment using dedicated variable JUSTMOCK_LOG_LEVEL. Possible values are: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL and OFF. Values from TRACE to CRITICAL enable tracing with different verbosity level in descending order, while OFF completely disables it. All traces are redirected to system debug output.
System debug could be visualized without debugger by using DebugView. The typical output from the tool look like as following:
Keep in mind that the tool captures the output from whole system, so for convenience the traces could be filtered by the keyword JustMockProfiler.
The traces inside DebugView window can be redirected to a file for further offline analysis.
Let's follow up an example, showing how the profiler trace can be enabled while executing test container from the command prompt step by step:
Setting up profiler trace level using environment variable
Launch DebugView and make sure that 'Capture Win32' and 'Capture Events' options are enabled
Setup filter in DebugView with keyword JustMockProfiler
Launch test execution in elevated (advanced) mode. The easiest way to achieve that is to use Telerik.JustMock.Console
"C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\Telerik.JustMock.Console.exe" --profiler-path-32="C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll" --command="vstest.console.exe" --command-args="bin\Debug\net45\UnitTestProject.dll"
- Profiler traces will start to appear inside DebugView window