Freigeben über


TFS 2010: Enable Test Case Management for upgraded Team Projects

Error Snapshot: (This error will occur when we use the test manger to connect to a TFS 2008 team project in the upgraded collection)

clip_image002

SOLUTION

=================

At a high level:

1. You must add the new work item types, test case and shared steps, to your upgraded team project to use Microsoft Test Manager.

2. You must add link types and categories that are provided with version 5.0 of the MSF process templates. You must customize existing work item types to have the new fields appear on the work item forms.

3. You must also upload a mapping file that specifies the work item type to support automatic creation of bugs or code defects by Microsoft Test Manager.

The witadmin and tcm tools used in commands are available in one of the two folder paths depending on x86 or x64 OS:

** x86 Path **

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE>

** x64 Path **

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>

Steps:

Step #1 Take backups of the TFS Configuration, Collection & warehouse db.

Step #2 Export the MSF Agile\CMMI 5.0 process templates to a folder. In my examples the process template is downloaded in the following folders:

C:\MSF for Agile Software Development v5.0

C:\MSF for CMMI Process Improvement v5.0

Instructions to download process templates are available here.

Step #3 Get the list of existing link types:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>witadmin.exe listlinktypes /collection:https://localhost:8080/tfs/DefaultCollection > c:\LinkTypes.txt

Step #4 If the LinkTypes.txt file does not contain the following type then proceed to #5:

Reference Name: Microsoft.VSTS.TestCase.SharedStepReferencedBy

Names: Test Case, Shared Steps

Topology: Dependency

Is Active: True

If the Test Case & Shared Steps link types are already present you should take a backup of the existing link types for Test Case & Shared Steps before proceeding to #5

Step #5 This is a one-time operation & it will add\upload the Shared Steps and Tested By Link Types to the collection:

witadmin importlinktype /collection:https://localhost:8080/tfs/DefaultCollection /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\LinkTypes\TestedBy.xml"

witadmin importlinktype /collection:https://localhost:8080/tfs/DefaultCollection /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\LinkTypes\SharedStep.xml"

You should run the following command to confirm that the link types have been uploaded to the collection:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>witadmin.exe listlinktypes /collection:https://localhost:8080/tfs/DefaultCollection > c:\LinkTypesVerify.txt

Step #6 onwards need to be performed against each TFS 2008 team project in the collection for which TCM needs to be enabled

Step #6 Export the list of work item type definitions(witd in short) by running the following command:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>witadmin listwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 > c:\Agile001.txt

You should see an output like:

(For MSF Agile 4.2)

Bug
Task
Quality of Service Requirement
Scenario
Risk

(For MSF CMMI 4.2)

Bug
Task
Issue
Change Request
Risk
Requirement
Review

Ensure that the TestCase & SharedStep witds are not listed as part of the output. If these witds are part of the output then you would need to follow the guidance available in the “Customizing an Existing Test Case Type of Work Item” section of this article.

Proceed to Step# 7.

Step #7 Add the TestCase & Shared witds:

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\TestCase.xml"

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\SharedStep.xml"

When you run the above commands you might get an error message as following:

ISSUE:

TF212018: Work item tracking schema validation error: TF26177: The field System.

AreaId cannot be renamed from 'AreaID' to 'Area ID'.

RESOLUTION: From:

When you import types of work items, an error message might indicate a naming conflict. This conflict occurs more frequently in deployments that were upgraded from an earlier release of Team Foundation. The friendly name was renamed for several system and test case management fields before the final release of Visual Studio Team Foundation Server 2010. System fields that were renamed include System.AreaID, System.IterationID, System.HyperLinkCount, System.ExternalLinkCount, and System.AttachedFileCount.

You can resolve this error by renaming the field either in the XML definition for a work item type or by using the witadmin changefield command-line tool. For more information, see Managing Work Item Fields [witadmin] .

Review the attributes that are assigned to the field in the project collection. You can use the witadmin listfields command:

witadmin listfields /collection:https://localhost:8080/tfs/DefaultCollection > c:\ListFields.txt

Look for the name attributes for the System.AreaID, System.IterationID, System.HyperLinkCount, System.ExternalLinkCount, and System.AttachedFileCount fields. An example taken from the c:\ListFields.txt file for the System.AreaId field:

Field: System.AreaId
Name: AreaID <-- Note: in TFS 2010 world this name would be “Area ID”
Type: Integer
Use: System Field
Indexed: False
Reportable As: None

To resolve the TF212018 error run the following commands and type ‘y’ when prompted to confirm the change:

(NOTE: These commands will need to be run just once at the collection level)

For TestCase

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.ExternalLinkCount" /name:"External Link Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.RelatedLinkCount" /name:"Related Link Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.HyperLinkCount" /name:"Hyperlink Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.AttachedFileCount" /name:"Attached File Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.AreaId" /name:"Area ID"

For SharedStep

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.IterationId" /name:"Iteration ID"

Sample output:

clip_image004

You should now be able to add the TestCase & SharedSteps witds by running the command:

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\TestCase.xml"

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\SharedStep.xml"

Proceed to Step# 8

Step #8 Run the following command & confirm that there are no catogeries are listed in the ExportCategories.xml file.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>witadmin.exe exportcategories /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile00 /f:c:\ExportCategories.xml

clip_image005Note

Importing the categories XML file into a project will overwrite all existing categories. Categories that were previously defined but not specified in the file will be deleted.

Proceed to Step# 9

Step #9 Add Categories for Work Item Types by running the following command:

witadmin importcategories /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\categories.xml"

You should get the following error:

clip_image007

 

ISSUE: (This is a MSF Agile Specific issue and **does not** happen with CMMI based team projects)

TF237059: The import of the category definition failed. In the type definition, category Requirement Category refers to a work item type that does not exist User Story.

RESOLUTION:

Open the C:\MSF for Agile Software Development v5.0\WorkItem Tracking\categories.xml

Change:

<CATEGORY name="Requirement Category" refname="Microsoft.RequirementCategory">

<DEFAULTWORKITEMTYPE name="User Story" />

</CATEGORY

To:

<CATEGORY name="Requirement Category" refname="Microsoft.RequirementCategory">

<DEFAULTWORKITEMTYPE name="Scenario" />

</CATEGORY>

Now you should be able to import the category by running the command:

witadmin importcategories /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\categories.xml"

Proceed to Step# 10

Step# 10 Modify Work Item Type Definitions

Perform the following tasks:
- Modify the Bug Type Definition
- Modify the Scenario(for Agile) or Requirement(for CMMI) Type Definition

Note: You should take backups of the existing bug and scenario\requirement type definitions before changing & uploading them back to the team project. Upload operation will overwrite the existing type definitions.

To back up the existing bug and scenario\requirement type definitions

Run the following commands:

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /n:bug /f:"C:\MSF for Agile Software Development v5.0\MyBug.xml"

For Agile team project run:

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /n:scenario /f:"C:\MSF for Agile Software Development v5.0\MyScenario.xml"

For CMMI team project run:

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /n:requirement /f:"C:\ MSF for CMMI Process Improvement v5.0\MyRequirement.xml"

Make copies of the MyBug.xml & MyScenario.xml\MyRequirement.xml

To modify MyBug.xml:

1. Open the C:\MSF for Agile Software Development v5.0\MyBug.xml file in VS

2. Perform the changes documented in the “Modify Bug Type Definition” section in this article and save the file.

Note:

ð Skip the first step which talks about exporting the type. We have already covered it.

ð Under the section "To modify the bug type definition", step 3 there is a missing "<"
From: FIELD name="System Info" refname="Microsoft.VSTS.TCM.SystemInfo" type="HTML" >
To : <FIELD name="System Info" refname="Microsoft.VSTS.TCM.SystemInfo" type="HTML">

ð For the section where the article says delete or replace xml, a suggestion here would be to comment the section that needs to be removed instead of deleting it.

3. Run the following command to upload the changes:

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\MyBug.xml"

To modify MyScenario or MyRequirement.xml file”:

1. Open the C:\MSF for Agile Software Development v5.0\ MyScenario.xml file in VS

2. Perform the changes documented in the “Modify the Scenario or Requirement Type Definition” section in this article and save the file.
Note:

ð Skip the first step which talks about exporting the type. We have already covered it.

ð For the section where the article says delete or replace xml, a suggestion here would be to comment the section that needs to be removed instead of deleting it.

3. Run the following command to upload the changes:

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\MyScenario.xml"

To verify the changes:

1. In Team Explorer , right-click your team project, and then click Refresh.

2. Right-click Work Items, point to New Work Item, and then click Scenario.

3. Verify that the new fields and changes to the work item form appear.

Step #11 Follow the instructions in the “Specifying the Bug Type to be Created in Microsoft Test Manager” section of the article.

Run the following command (I saved the bugfieldmappings.xml file to C:\MSF for Agile Software Development v5.0 folder):

tcm bugfieldmapping /import /mappingfile:"C:\MSF for Agile Software Development v5.0\bugfieldmappings.xml" /collection:https://localhost:8080/tfs/DefaultCollection /teamproject:Agile001

Now you should be able to launch the Test Manager & start creating test cases for your TFS 2008 team project.

Summary:

Run the following command once per Team Project Collection:

-- Import Link Types

witadmin importlinktype /collection:https://localhost:8080/tfs/DefaultCollection /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\LinkTypes\TestedBy.xml"

witadmin importlinktype /collection:https://localhost:8080/tfs/DefaultCollection /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\LinkTypes\SharedStep.xml"

-- Fix Errors in Step #7

For TestCase

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.ExternalLinkCount" /name:"External Link Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.RelatedLinkCount" /name:"Related Link Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.HyperLinkCount" /name:"Hyperlink Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.AttachedFileCount" /name:"Attached File Count"

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.AreaId" /name:"Area ID"

For SharedStep

witadmin changefield /collection:https://localhost:8080/tfs/DefaultCollection /n:"System.IterationId" /name:"Iteration ID"

Run the following command once per Team Project:

NOTE: These command have to be run against the xml files for the process template that corresponds to your team project. I have two team projects Agile001 and CMMI001 based on Agile and CMMI respectively. The folder paths referred in the file paths should be adjusted to C:\MSF for Agile Software Development v5.0 and C:\MSF for CMMI Process Improvement v5.0 based on Agile or CMMI team projects.

**AGILE VERSION**

--ADD WIT TYPES

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\TestCase.xml"

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\TypeDefinitions\SharedStep.xml"

-- ADD CATEGORY TYPES

witadmin importcategories /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\WorkItem Tracking\categories.xml"

-- MODIFY THE BUG TYPE DEFINITION

--First export the type
witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /n:bug /f:"C:\MSF for Agile Software Development v5.0\MyBug.xml"

--Make change to type in VS
--Import the changed type

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\MyBug.xml"

--MODIFY the Scenario or Requirement Type Definition

--First export the type

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /n:scenario /f:"C:\MSF for Agile Software Development v5.0\MyScenario.xml"

--Make change to type in VS

--Import the changed type

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:Agile001 /f:"C:\MSF for Agile Software Development v5.0\MyScenario.xml"

-- Add bugfieldmapping

tcm bugfieldmapping /import /mappingfile:"C:\MSF for Agile Software Development v5.0\bugfieldmappings.xml" /collection:https://localhost:8080/tfs/DefaultCollection/teamproject:Agile001

**CMMI VERSION**

--ADD WIT TYPES

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /f:"C:\MSF for CMMI Process Improvement v5.0\WorkItem Tracking\TypeDefinitions\TestCase.xml"

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /f:"C:\MSF for CMMI Process Improvement v5.0\WorkItem Tracking\TypeDefinitions\SharedStep.xml"

-- ADD CATEGORY TYPES

witadmin importcategories /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /f:"C:\MSF for CMMI Process Improvement v5.0\WorkItem Tracking\categories.xml"

-- MODIFY THE BUG TYPE DEFINITION

--First export the type

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /n:bug /f:"C:\MSF for CMMI Process Improvement v5.0\MyBug.xml"

--Make change to type in VS

--Import the changed type

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /f:"C:\MSF for CMMI Process Improvement v5.0\MyBug.xml"

--MODIFY the Scenario or Requirement Type Definition

--First export the type

witadmin exportwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /n:requirement /f:"C:\MSF for CMMI Process Improvement v5.0\MyRequirement.xml"

--Make change to type in VS

--Import the changed type

witadmin importwitd /collection:https://localhost:8080/tfs/DefaultCollection /p:CMMI001 /f:"C:\MSF for CMMI Process Improvement v5.0\MyRequirement.xml"

-- Add bugfieldmapping

tcm bugfieldmapping /import /mappingfile:"C:\MSF for CMMI Process Improvement v5.0\bugfieldmappings.xml" /collection:https://localhost:8080/tfs/DefaultCollection /teamproject:CMMI001

Comments

  • Anonymous
    September 29, 2010
    You are my hero, actually managed to change my 'Scrum Light Template' my replacing "bug" with "defect" and "Scenario" with "UserStory".

  • Anonymous
    January 04, 2011
    Excellent post!. I was able to resolve  issues arising from TFS 2008 to TFS 2010 upgrade. I was able to get MS test manager working properly following the psot.

  • Anonymous
    February 03, 2011
    This is an astonishing amount of work to make a Microsoft product work with a Microsoft product. I only wished to run the trial version of Test Professional 2010. Looks like this won't be happening now. FAIL. Good post btw.

  • Anonymous
    December 12, 2011
    Hi, I’m a French user of TeamSystem. We currently use the English version of CMMI 4.2 process template. On step #2, I can only download the French version of CMMI 5.0 process template. It causes incompatibility problems for next steps. How can I get the English version of  CMMI 5.0 process template? Thanks

  • Anonymous
    December 13, 2011
    Well, I resolved my problem. I downloaded an English trial version of TFS 2010. After installing it, I retrieved the English process template with Visual Studio 2010.

  • Anonymous
    February 08, 2012
    Hi Thanks for a nice article. could you please anser below question? Do i need tfs/VS admin rights to follow these steps? Thanks in advance...

  • Anonymous
    August 09, 2012
    Thanks for your excellent description. Very helpful. Could update an existing Team Project without problems.