Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.85 KB

File metadata and controls

42 lines (31 loc) · 1.85 KB
title description ms.date ms.topic author ms.author manager ms.subservice
Debug unit tests with Test Explorer
Debug and analyze unit tests with Test Explorer in Visual Studio by setting breakpoints to diagnose test method performance issues.
03/24/2023
how-to
mikejo5000
mikejo
jmartens
test-tools

Debug and analyze unit tests with Test Explorer

You can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly takes you back and forth between the unit tests and the project under test. To start debugging:

  1. In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug.

    [!NOTE] Because test methods can run in any order, set breakpoints in all the test methods that you want to debug.

  2. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.

    ::: moniker range=">=vs-2022" Test execution details ::: moniker-end ::: moniker range="vs-2019" Test execution details ::: moniker-end

    For more information, about the debugger, see Debug in Visual Studio.

Diagnose test method performance issues

To diagnose why a test method is taking too much time, select the method in Test Explorer and then choose Profile on the right-click menu. See Instrumentation profiling report.

Note

This feature is not currently supported for .NET Core.

Related content