Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Debug while a Test is Running

You can debug your code while a unit test is running. There are two ways to do this:

How to debug code while running a unit test

  1. (Optional) Set one or more breakpoints in your code. 

  2. In the Test List Editor or the Test View window, select the unit tests for the methods you want to test. For information about opening either of these windows, see Team System Testing Tools Windows.

  3. Press CTRL+R and then CTRL+T.

    - or -

    Next to the Run button in the Test View window, click the down arrow and select Debug Selection.

    - or -

    Right-click in the Test View window and then click Debug Selection.

    - or -

    Next to the Run button in the Test List Editor, click Debug Checked Tests.

    - or -

    Right-click in the Test List Editor and then click Debug Checked Tests.

    - or -

    On the Test menu, click Debug Tests or Debug All Tests.

    The first 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.

    If you selected multiple tests in the Test View window or the Test List Editor, or if you clicked Debug All Tests, the test run continues with subsequent tests. In those tests as well, the test runs until encountering a breakpoint.

    NoteNote:

    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, by using a controller and an agent.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft