Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Test Edition
Testing Tools Tasks
Running Tests
 How to: Debug while a Test is Runni...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Team System
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.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker