tcm: Customize and manage the test experience

Customize and manage the test experience [tcm and Microsoft Test Manager]

You can customize three of the features that are supported in Microsoft Test Manager using the tcm fieldmapping command. This command allows you to change the bug type used to automatically file bugs in Test Manager, and to customize the drop-down menu or pick lists for resolution states and failure types.

The tcm command-line tool only works when run against an on-premises Team Foundation Server. To run the tool, open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:

cd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE

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

Also, you can use tcm command options to import and run automated tests for a test plan.


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. See Set administrator permissions for team project collections.

tcm fieldmapping /export /collection:CollectionURL /teamproject:Project /type:resolutiontype|bug|failuretype /mappingfile:path [/login:username,[password]]
tcm fieldmapping /import /collection:CollectionURL /teamproject:Project /type:resolutiontype|bug|failuretype /mappingfile:path [/login:username,[password]]




Specifies export of the field mapping file of the type specified. For the syntax of supported file types, see the Remarks section.


Specifies import of the field mapping file.


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


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:


/teamproject: Project

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

/type:resolutiontype | bug | failuretype

The type of file to import or export. For the syntax structure of each file type, see bug, resolution states, and failure types.

/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.

Each time that you run the tcm fieldmapping import command, the contents of the existing field mapping file are replaced with the contents that you import.

Mapping file for bug work item type

When Test Manager creates a bug, the mapping file defines the type of work item to create and fills in three data fields: 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 these three fields are automatically filled in.

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’re adding another type of work item to the bug category or you’re working with a customized process template, you might have to use the tcm command.

You can define only one type of work item to be created when you run tests that use Test Manager.

The following XML syntax lists the default contents of the bug field mappings file. All three fields must be specified when you import a bug field mappings file.

<?xml version="1.0" encoding="utf-16"?>
<BugFilerMappings workitemtypetocreate="Bug">

For more information about fields that are used to track information that Test Manager finds, see Build and test integration field reference.

Mapping file for resolution states

The following XML syntax lists the default contents of the resolution states defined for the default process templates.

<?xml version="1.0" encoding="utf-8"?>
    <TestResolutionState name="Needs investigation" />
    <TestResolutionState name="Test issue" />
    <TestResolutionState name="Product issue" />
    <TestResolutionState name="Configuration issue" />

Before you create a team project, you can customize the resolution states defined in the process template.

When you analyze failed tests, you assign the failure type and resolution state.

Analyse test run page in MTM

Mapping file for failure types

The following XML syntax lists the default failure types defined for a team project.

<?xml version="1.0" encoding="utf-16"?>
  <TestFailureType name="Regression" />
  <TestFailureType name="New Issue" />
  <TestFailureType name="Known Issue" />
  <TestFailureType name="Unknown" />

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\"

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 fieldmapping /import /type:bug /mappingfile:"C:\Users\AdminUser\Documents\bugfieldmappings.xml" /collection:http://AdventureWorksServer:8080/tfs/Collection1 /teamproject:AdventureWorks 
© 2015 Microsoft