DebugView Class

Provides introspection and tracing capabilities for ease of debugging failing tests.

Namespace: Telerik.JustMock
Assembly: Telerik.JustMock(in Telerik.JustMock.dll)


public static class DebugView
Visual Basic
<ExtensionAttribute> _
Public NotInheritable Class DebugView


Often it’s not very clear why a test that uses the mocking API fails. A test may have multiple arrangements, each with various overlapping argument matchers. When you have a complex set of arrangements and the system under test makes a call to a mock, it’s sometimes hard to understand which arrangement actually gets executed and which expectations get updated. TheDebugViewclass can help in such times. It can be used in two ways – to provide an overview of the current internal state of the mocking API, and to provide a step-by-step replay of the interception events happening inside the mocking API. The current internal state is exposed through the CurrentState property. It contains a human-readable description of the current state of the mocking API. It describes in detail the state of all occurrence expectations and the number of calls to all intercepted methods. The first part is useful when debugging failing expectations from arrangements. The second part is useful for debugging failing occurrence asserts. The step-by-step replay is intended for use with an interactive debugger (e.g. the Visual Studio managed debugger). To begin using it, add the DebugView class to a Watch in the debugger. Break the test execution before your test begins. Set the IsTraceEnabled property to true from the Watch window. Now, as you step over each line in your test, the FullTrace and LastTrace properties will be updated to show the events happening inside the mocking API. FullTrace will show the entire event log so far. LastTrace will contain all events that have happened since the debugger last updated the Watch window, but only if any new events have actually occurred.

Inheritance Hierarchy

See Also

DebugView Members

Telerik.JustMock Namespace

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article