How to: Create a Work Item from a Test Result

By using the Test Results window, you can create a bug directly from a test result.

Important noteImportant Note:

A bug is a type of work item. The work item database resides on a Team Foundation Server computer. This means that you can create work items, including bugs, only if you have Team Explorer installed, and your Visual Studio user session is connected to a Team Foundation Server computer. For more information, see How to: Connect to Team Foundation Server.

To create a bug

  1. To obtain test results, run one or more tests. For more information, see How to: Run Selected Tests.

    This displays one row in the Test Results window for each test you ran. You can now create one or more bugs for each row that is displayed. Each row is a test result.

  2. In the Team Explorer window, select a project by clicking it.


    You cannot create a bug from the Test Results window unless you have selected a project or a node under the project.

  3. In the Test Results window, right-click the test result for which you want to create a bug, point to Create Work Item, and then click Bug.


    After clicking Create Work Item, you could create any type of work item listed as an option, not necessarily a bug.

    A New Bug page is displayed in the main editing window. This page is initialized with relevant data. For example, the bug's title is created from the name of the test and the error message that describes the test result. The new bug also has the test result attached, in the form of a .trx file.

  4. (Optional) Edit the information on the New Bug page. You can, for example, change the bug's priority, its state, or the person to whom it is assigned. Additionally, you can add descriptive information and attach files.

  5. Right-click the tab at the top of the New Bug page and then click Save New Bug.

    The bug is saved and assigned a bug number.

See Also


How to: Add a Test Result to a Work Item

How to: Debug while a Test is Running

How to: Enable Reporting of Test Results

How to: Associate a Work Item with a Test