TFS 2010 - Customization of Work Item Type Definition (Part 1)

Posted by: Subodh Sohoni , on 8/22/2011, in Category Visual Studio, VSTS & TFS
Views: 57357
Abstract: With this article, we will start a series of articles to review the customization of work item type definition in the context of changes that we observe in work item tracking in TFS 2010. In this article, we will cover the tools and process to export work item type definition from an existing team project and then import it back with some modifications. We will use command line tools and XML editing in the notepad. We will also see how to export and import Global Lists from TFS.

With this article, we will start a series of articles to review the customization of work item type definition in the context of changes that we observe in work item tracking in TFS 2010. Sometime back, I had written a series of articles on customization of work item type definition starting with VSTS - Workitem Architecture, Design Considerations and Customization: Part 1. In TFS 2010, Microsoft has introduced new tools like Team Foundation Power Tools to do the work item type definition customization, Microsoft Test Manager 2010 and new concepts like hierarchical work items, categorization of work items etc. TFS 2010 also has new work item types like Test Case and Shared Steps.

Update: Part 2 of this article can be viewed over here TFS 2010 - Edit Work Item Type Definition using Team Foundation Power Tool

We take up a case of work item type Defect instead of Bug. Many organizations use the term defect in place of Bug and they are comfortable keeping that same term in TFS also. We will begin with getting the definition of work item of the type Bug. We will do the simple necessary modifications in it using a tool built in TFS 2010 that is called WitAdmin. This modification will create a new work item type called Defect in a team project. Then we will use the Team Foundation Power Tool (download from http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f )to do more complex modification like addition of field, change layout and workflow of the work item. Finally we will also see how we make the Microsoft Test Manager 2010 aware of this change so that by default it will create an instance of Defect rather than Bug work item type. I am going to walk you through the process step by step. For the sake of doing it practically I have used the Virtual Machine provided by Brian Keller (Microsoft Sr. Technical Evangelist for Visual Studio Application Lifecycle Management). It can be downloaded from http://blogs.msdn.com/b/briankel/archive/2010/06/25/now-available-visual-studio-2010-rtm-virtual-machine-with-sample-data-and-hands-on-labs.aspx. In case you do not want to download that virtual machine, you can work with any installation of TFS 2010 and Visual Studio 2010 (Ultimate or Test Professional 2010). If you do not want to do it practically then also the screenshots in each step will give you complete idea of the process.

 

We begin with getting the Bug work item type definition in a XML file.

Step 1: Ensure that virtual machine named Visual Studio 2010 RTM is open and you are logged on as Administrator to it.

Step 2: Open windows explorer and create a folder named WITD on the C drive.

Step 3: Open the Visual Studio 2010 Command Prompt and Run it as administrator. To do that go to Start – All Programs – Microsoft Visual Studio 2010 – Visual Studio tools – Right click on Microsoft Visual Studio Command Prompt (2010) and select Run as Administrator from the menu.

tfs-run-as-admin

Step 4: Enter following command:

WitAdmin ExportWitd /collection:http://localhost:8080/tfs/DefaultCollection /p:”Tailspin Toys” /n:Bug /f:”C:\WITD\Bug.xml”

witadmin- export-witd

Step 5: Operation Complete message will appear below the command that you had typed

operation-complete-message

Now that we have the Bug work item type definition in a XML file, we will simply edit it in Notepad.

Step 6: In the Windows Explorer you will find the file Bug.xml is created. Select that and open it for editing.

bug-xml

Step 7: It will open in notepad where we can edit it now

bug-xml-notepad

Step 8: Change the name from Bug to Defect and save the file.

tfs-defect

And now we will import it back in the TFS 2010 in the same team project. We may as well import it in another TFS and / or other project too without any issue.

Step 9: Use the command

WitAdmin ImportWITD /collection:http://localhost:8080/tfs/DefaultCollection /p:"Tailspin Toys" /f:"C:\WITD\Bug.xml"

witadmin-importwitd

Step 10: You will get a message that Work Item Type Import has completed

workitem-completed

Step 11: You may now start Visual Studio 2010, open Team Explorer and browse to the Team Project named Tailspin Toys. Expand to the Work Items node and right click on it. Select the option New Work Item and you will find Defect appear in the list.

defect-work-item

We will now create a Global List that we will be using in the Defect work item type definition. Global lists are as the name suggests, list of items that can be used in any work item to assign values to any field. We will export existing Global Lists in an XML file and then add our Global List to it and then save it under the TFS.

Step 12: To export global lists, in the same command prompt type command:

WitAdmin ExportGlobalList /collection:http://localhost:8080/tfs/DefaultCollection /f:"C:\WITD\GL.xml"

You will get a message that Global Lists has been exported.

witadmin-export-globallist

 

Open the GL.xml to edit in notepad and just before the tag </gl:GLOBALLISTS> add following tags

<GLOBALLIST name="Organizational Divisions">
    <LISTITEM value="Paper Airplanes" />
    <LISTITEM value="Model Aircrafts" />
    <LISTITEM value="Model Helicopters" />
    <LISTITEM value="New Projects" /> 
</GLOBALLIST>

Step 13: Save the file GL.xml in the same folder (C:\WITD) and close notepad.

Step 14: At the command prompt enter command

WitAdmin ImportGlobalList /collection:http://localhost:8080/tfs/DefaultCollection /f:"C:\WITD\GL.xml"

You will get message that Global list was successfully imported.

witadmin-import-export

We will use this Global list in the next part of customization of work item type definition using Team Foundation Power Tool.

Update: Part 2 of this article can be viewed over here TFS 2010 - Edit Work Item Type Definition using Team Foundation Power Tool

Summary: In this article, we have covered the tools and process to export work item type definition from an existing team project and then import it back with some modifications. We used command line tools and XML editing in the notepad. We have also seen how to export and import Global Lists from TFS. In the next article in the series, I will walk you through the use of Team Foundation Power Tool for editing the work item type definition.

Give a +1 to this article if you think it was well written. Thanks!
Recommended Articles
Subodh Sohoni, Team System MVP, is an MCTS – Microsoft Team Foundation Server – Configuration and Development and also is a Microsoft Certified Trainer(MCT) since 2004. Subodh has his own company and conducts a lot of corporate trainings. He is an M.Tech. in Aircraft Production from IIT Madras. He has over 20 years of experience working in sectors like Production, Marketing, Software development and now Software Training. Follow him on twitter @subodhsohoni


Page copy protected against web site content infringement by Copyscape


User Feedback

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel