How to: Debug while a Test is Running
You can debug your code while a unit test is running.
There are two ways to debug code while a test is running. If your production code or the test itself are running in either an IIS process or in the ASP.NET Development Server process, use the procedure that is described in. Otherwise, use the procedure that is described in this topic.
How to debug code while running a unit test
(Optional) Set one or more breakpoints in your code.
In Test Manager or Test View, select the unit tests for the methods you want to test. For information about opening either of these windows, see.
Next to the Run button in the Test View window, click the down arrow and select Debug Selection.
- or -
Next to the Run button in the Test Manager window, click Debug Checked Tests. The unit test runs until a breakpoint is encountered in your code. While the test is running, you can use the usual debugging commands, such as Continue and Step Out. The unit test does not produce a final result until the code path through the method has been completed.
You can do this only while you are running tests locally — on your own computer. In other words, you cannot debug while running tests remotely, using a controller and agent.