Specifying the Bug Type to File By Using Microsoft Test Manager

You can enable the automatic creation of a work item when a tester finds a code defect when using Microsoft Test Manager. The tcm bugfieldmapping command-line tool supports the import and export of a mapping file to the team project. The mapping file defines the type of work item to create and the three data fields to be filled in by Microsoft Test Manager. The three fields are reproducible steps, system information, and the build in which the defect was found. When a tester runs a test and finds a defect, they can create a bug in which the three fields are automatically filled in.

Note

If your team project was created with one of the default process templates provided with Team Foundation Server, the bug work item type is already enabled. However, if you are adding another type of work item to the bug category or you are working with a customized process template, you may need to use the tcm command.

To access the tcm command-line tool, open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:

cd %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE

On a 64-bit edition of Windows, replace %programfiles% with %programfiles(x86)%.

For more information about additional tcm command-line tool options, see tcm: Importing and Running Automated Tests for a Test Plan from the Command Line.

For more information about the bug type of work item, see Bug (Scrum), Bug (Agile), or Bug (CMMI).

Required Permissions

For the team project where the work item types are defined, you must be a member of the Team Foundation Administrators security group or the Project Administrators security group. For more information, see Team Foundation Server Permissions.

Note

Even if you log on with administrative permissions, you must open an elevated Command Prompt window to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt window, click Start, right-click Command Prompt, and then click Run as Administrator. For more information, see the following page on the Microsoft Web site: User Access Control.

tcm bugfieldmapping /export /mappingfile:path /collection:CollectionURL /teamproject:Project [/login:username,[password]]

tcm bugfieldmapping /import /mappingfile:path /collection:CollectionURL /teamproject:Project [/login:username,[password]]

Parameters

Parameter

Description

/export

Specifies export of the bug field mapping file. This file defines the work item type to create when a code defect is found by using Microsoft Test Manager. It also specifies the work item fields that will be populated with data that is defined in Microsoft Test Manager, such as the repro steps, system information, and the build in which the code defect was found. For more information, see Contents of the Bug Field Mappings File later in this topic.

/import

Specifies import of the bug field mapping file.

/mappingfile:Path

The path and file name of the XML definition file that contains the bug field mappings.

Note

If you use Windows Vista, you might not have permissions to certain folders. If you try to export the work item type to a location where you do not have permissions, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. To avoid this redirection, you can export the file to a location where you have permissions. For more information about registry virtualization, see the following pages on the Microsoft Web site: Registry Virtualization and Common file and registry virtualization issues in Windows Vista.

/collection:CollectionURL

Specifies the uniform resource identifier (URI) of the team project collection. The format for the URI is as follows: http://ServerName:Port/VirtualDirectoryName/CollectionName

If no virtual directory is used, the format for the URI is as follows:

http://ServerName:Port/CollectionName

/teamproject:Project

Specifies the name of the team project for which the bug field mappings are to be applied. This team project must be defined in the team project collection that is specified by the /collection parameter.

/login:UserName,Password

Optional. Specifies the name and password of a user who is logged on to the application-tier server for Team Foundation and who has permissions to run the command.

You would use this option when your Windows credentials do not have the appropriate permissions, you are using basic authentication, or you are not on a domain.

/? or help

Displays help about the command in the Command Prompt window.

Remarks

The bug field mappings file provides Microsoft Test Manager with the name of the work item type to create and the fields to fill in for the work items that it creates.

You can define only one type of work item to be created when you run tests that use Microsoft Test Manager. Each time that you run the tcm bugfieldmapping import command, the work item type that is specified by the BugFilerMappings element replaces whatever type of work item was previously specified. For example, the following code indicates creation of the work items that are based on the type named AWBug.

<BugFilerMappings workitemtypetocreate="AWBug">

For more information, see How to: Submit a Bug Using Microsoft Test Manager.

Contents of the Bug Field Mappings File

The following XML syntax lists the default contents of the bug field mappings file. The file specifies the type of work item to create and the three work item fields that Microsoft Test Manager will automatically fill in, based on data that was found during the test run. All three fields must be specified when you import a bug field mappings file.

<?xml version="1.0" encoding="utf-16"?>
<BugFilerMappings workitemtypetocreate="Bug">
   <ReproSteps>Microsoft.VSTS.TCM.ReproSteps</ReproSteps>
   <SystemInformation>Microsoft.VSTS.TCM.SystemInfo</SystemInformation>
   <BuildFoundIn>Microsoft.VSTS.Build.FoundIn</BuildFoundIn>
</BugFilerMappings>

For more information about fields that are used to track information that Microsoft Test Manager finds, see Build and Test Integration Field Reference.

Examples

Unless otherwise specified, the following values apply in each example:

  • URI for the team project collection: http://AdventureWorksServer:8080/tfs/Collection1

  • Project name: AdventureWorks

  • Bug field mapping file name: bugfieldmappings.xml

  • Folder location: "C:\Users\AdminUser\Documents\"

Import the Bug Field Mappings File

The following command imports the contents of the bugfieldmappings.xml file to the AdventureWorks team project that is defined in Collection1 on the server that is named AdventureWorksServer.

tcm bugfieldmapping /import /mappingfile:"C:\Users\AdminUser\Documents\bugfieldmappings.xml" /collection:http://AdventureWorksServer:8080/tfs/Collection1 /teamproject:AdventureWorks 

See Also

Tasks

How to: Submit a Bug Using Microsoft Test Manager

Concepts

Customize Process Templates

How to: Run Automated Tests from the Command Line Using Tcm

Other Resources

Using Team Foundation Server Command-Line Tools