Makale Özeti

Yazılım Geliştiriciler İçin Team Foundation Server – Work Item Özelleştirme

Makale

Yazılım Geliştiriciler İçin Team Foundation Server – Work Item Özelleştirme

 

Team Foundation Work Item Tracking sistemi esnek bir yapıya sahiptir. Ve bu sayede her Team Project kendi work item tiplerini tanımlayabilir ve kullanabilir. Ayrıca mevcut bir projede yer alan work itemlar özelleştirilebilir veya yeni work item tipleri eklenebilir.

Work Item özelleştirilmesine ihtiyaç duyulmasının çeşitli sebepleri olabilir. Örneğin work item için başka bir ortam ile ilgili bilgi tutmak (birlikte çalışılan bir programdaki referans numarası gibi)  yada yazılım geliştirme sürecine bağlı olarak tamamen özelleştirilmiş bir work item oluşturmak istenebilir.

Work Item tipleri XML tabanlı dosya olarak tutulurlar. MSDN dökumantasyonunda bu XML dosyasının şemasından bahsedilmektedir. Team Foundation Server Service Pack 1'e kadar bir work item formu üzerinde sadece önceden tanımlı olan work item kontrolleri kullanılabilinirdi. Ancak SP1 ile beraber gelen bir özellik ile work item formu üzerinde windows forms kullanıcı kontrolleri barındırılabilir oldu ve bu sayede work item form tasarımları daha zengin bir hale dönüştürülebilir oldu.

Work Item özelleştirmesi için en temel çıkış noktası yep yeni bir work item tasarlamaktan ziyade mevcut bir work itemı değiştirmektir. Bunun için mevcut work itemlardan birisinin xml versini elde etmek ilk adım olacaktır.

Work Item XML metadatasını export etmek(dışarı almak)

Work Item XML metadatasını export etmek için witexport.exe aracı kullanılır. Visual Studio Command Prompt'u açıp aşağıdaki komutu çalıştırarak "TFSERVER" isimli Team Foundation Server'da yer alan "testproject1" isimli Team Project'in "Task" isimli work item tipini oluşturan xml dosyasını "c:\temp" lokasyonuna "task.xml" adı ile kaydedebilirsiniz.

witexport /f c:\temp\task.xml /t tfserver /p testproject1 /n task


Task work item tipini oluşturan xml dokümanını elde ettiğimize göre bu dokümanı özelleştirebiliriz.

Task2 adında ve Task work item tipinden farklı olarak TakipID adında ekstra bir alan içeren bir work item tipi oluşturmak için xml dokümanını aşağıdaki şekilde düzenleyelim. Kalın olarak gösterilenler xml üzerindeki değişiklik ve eklemeler ile iligli satırlardır.

 

 <?xml version="1.0" encoding="utf-8"?>
<witd:WITD application="Work item type editor" version="1.0" xmlns:witd="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typedef">
<WORKITEMTYPE name="Task2">
<DESCRIPTION>Includes information to track the task through the MSF Agile lifecycle</DESCRIPTION>
<FIELDS>
<FIELD name="Title" refname="System.Title" type="String" reportable="dimension">
<HELPTEXT>Short description of the task used to differentiate it in a list or report</HELPTEXT>
<REQUIRED />
</FIELD>
<FIELD name="State" refname="System.State" type="String" reportable="dimension">
<HELPTEXT>The workflow state of the task</HELPTEXT>
</FIELD>
<FIELD name="Rev" refname="System.Rev" type="Integer" reportable="dimension" />
<FIELD name="Changed By" refname="System.ChangedBy" type="String" reportable="dimension">
<VALIDUSER />
</FIELD>
<FIELD name="Issue" refname="Microsoft.VSTS.Common.Issue" type="String" reportable="dimension">
<HELPTEXT>Used to highlight a task, e.g., to mark it as an issue</HELPTEXT>
<REQUIRED />
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="Yes" />
<LISTITEM value="No" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="No" />
</FIELD>
<FIELD name="State Change Date" refname="Microsoft.VSTS.Common.StateChangeDate" type="DateTime">
<WHENCHANGED field="System.State">
<SERVERDEFAULT from="clock" />
</WHENCHANGED>
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FIELD>
<FIELD name="Activated Date" refname="Microsoft.VSTS.Common.ActivatedDate" type="DateTime" reportable="dimension">
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FIELD>
<FIELD name="Activated By" refname="Microsoft.VSTS.Common.ActivatedBy" type="String" reportable="dimension">
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FIELD>
<FIELD name="Reason" refname="System.Reason" type="String" reportable="dimension">
<HELPTEXT>The reason why the task is in the current state</HELPTEXT>
</FIELD>
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" reportable="dimension">
<VALIDUSER />
</FIELD>
<FIELD name="Work Item Type" refname="System.WorkItemType" type="String" reportable="dimension" />
<FIELD name="Closed By" refname="Microsoft.VSTS.Common.ClosedBy" type="String" reportable="dimension">
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FIELD>
<FIELD name="Closed Date" refname="Microsoft.VSTS.Common.ClosedDate" type="DateTime" reportable="dimension">
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FIELD>
<FIELD name="Rank" refname="Microsoft.VSTS.Common.Rank" type="String" reportable="dimension">
<HELPTEXT>Stack rank to prioritize work</HELPTEXT>
</FIELD>
<FIELD name="Created Date" refname="System.CreatedDate" type="DateTime" reportable="dimension" />
<FIELD name="Created By" refname="System.CreatedBy" type="String" reportable="dimension" />
<FIELD name="Integration Build" refname="Microsoft.VSTS.Build.IntegrationBuild" type="String" reportable="dimension">
<HELPTEXT>The build in which the task was completed</HELPTEXT>
<SUGGESTEDVALUES expanditems="true">
<LISTITEM value="&lt;None&gt;" />
</SUGGESTEDVALUES>
</FIELD>
<FIELD name="Discipline" refname="Microsoft.VSTS.Common.Discipline" type="String" reportable="dimension">
<HELPTEXT>The discipline to which the task belongs</HELPTEXT>
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="Development" />
<LISTITEM value="Test" />
<LISTITEM value="Project Management" />
<LISTITEM value="Requirements" />
<LISTITEM value="Architecture" />
<LISTITEM value="Release Management" />
</ALLOWEDVALUES>
</FIELD>
<FIELD name="Remaining Work" refname="Microsoft.VSTS.Scheduling.RemainingWork" type="Double" reportable="measure" formula="sum">
<HELPTEXT>An estimate of the number of hours remaining to complete the task</HELPTEXT>
</FIELD>
<FIELD name="Completed Work" refname="Microsoft.VSTS.Scheduling.CompletedWork" type="Double" reportable="measure" formula="sum">
<HELPTEXT>The number of hours that have been completed for this task</HELPTEXT>
</FIELD>
<FIELD name="Baseline Work" refname="Microsoft.VSTS.Scheduling.BaselineWork" type="Double" reportable="measure" formula="sum">
<HELPTEXT>The number of hours of work from the baseline plan</HELPTEXT>
</FIELD>
<FIELD name="Finish Date" refname="Microsoft.VSTS.Scheduling.FinishDate" type="DateTime" reportable="dimension">
<HELPTEXT>The date to finish the task</HELPTEXT>
</FIELD>
<FIELD name="Task Hierarchy" refname="Microsoft.VSTS.Scheduling.TaskHierarchy" type="String" reportable="dimension">
<HELPTEXT>A string representing MS-Project context for the given task</HELPTEXT>
</FIELD>
<FIELD name="Start Date" refname="Microsoft.VSTS.Scheduling.StartDate" type="DateTime" reportable="dimension">
<HELPTEXT>The date to start the task</HELPTEXT>
</FIELD>
<FIELD name="Exit Criteria" refname="Microsoft.VSTS.Common.ExitCriteria" type="String" reportable="dimension">
<HELPTEXT>Flag to determine if this scenario should be tracked as an exit criteria for the iteration</HELPTEXT>
<REQUIRED />
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="Yes" />
<LISTITEM value="No" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="No" />
</FIELD>
<FIELD name="Description" refname="System.Description" type="PlainText" />
<FIELD name="History" refname="System.History" type="History">
<HELPTEXT>Discussion thread and other historical information</HELPTEXT>
</FIELD>
<FIELD name="RelatedLinkCount" refname="System.RelatedLinkCount" type="Integer" />
<FIELD name="Iteration Path" refname="System.IterationPath" type="TreePath" reportable="dimension">
<HELPTEXT>The iteration of the product with which this task is associated</HELPTEXT>
</FIELD>
<FIELD name="IterationID" refname="System.IterationId" type="Integer" />
<FIELD name="ExternalLinkCount" refname="System.ExternalLinkCount" type="Integer" />
<FIELD name="Team Project" refname="System.TeamProject" type="String" reportable="dimension" />
<FIELD name="HyperLinkCount" refname="System.HyperLinkCount" type="Integer" />
<FIELD name="AttachedFileCount" refname="System.AttachedFileCount" type="Integer" />
<FIELD name="Node Name" refname="System.NodeName" type="String" />
<FIELD name="Area Path" refname="System.AreaPath" type="TreePath" reportable="dimension">
<HELPTEXT>The area of the product with which this task is associated</HELPTEXT>
</FIELD>
<FIELD name="Revised Date" refname="System.RevisedDate" type="DateTime" />
<FIELD name="Changed Date" refname="System.ChangedDate" type="DateTime" reportable="dimension" />
<FIELD name="ID" refname="System.Id" type="Integer" reportable="dimension" />
<FIELD name="AreaID" refname="System.AreaId" type="Integer" />
<FIELD name="Authorized As" refname="System.AuthorizedAs" type="String" />
<FIELD name="TakipID" refname="Yazgelistir.TakipID" type="Integer" />
</FIELDS>
<WORKFLOW>
<STATES>
<STATE value="Active">
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ClosedDate">
<EMPTY />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ClosedBy">
<EMPTY />
</FIELD>
</FIELDS>
</STATE>
<STATE value="Closed" />
</STATES>
<TRANSITIONS>
<TRANSITION from="" to="Active">
<REASONS>
<DEFAULTREASON value="New" />
</REASONS>
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
<COPY from="currentuser" />
<VALIDUSER />
<REQUIRED />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
<SERVERDEFAULT from="clock" />
</FIELD>
<FIELD refname="System.AssignedTo">
<DEFAULT from="currentuser" />
</FIELD>
</FIELDS>
</TRANSITION>
<TRANSITION from="Active" to="Closed">
<REASONS>
<DEFAULTREASON value="Completed" />
<REASON value="Deferred" />
<REASON value="Obsolete" />
<REASON value="Cut" />
</REASONS>
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ClosedDate">
<SERVERDEFAULT from="clock" />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ClosedBy">
<COPY from="currentuser" />
<VALIDUSER />
<REQUIRED />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
<READONLY />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
<READONLY />
</FIELD>
</FIELDS>
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.Checkin" />
</ACTIONS>
</TRANSITION>
<TRANSITION from="Closed" to="Active">
<REASONS>
<DEFAULTREASON value="Reactivated" />
</REASONS>
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ActivatedBy">
<COPY from="currentuser" />
<VALIDUSER />
<REQUIRED />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
<SERVERDEFAULT from="clock" />
</FIELD>
<FIELD refname="System.AssignedTo">
<COPY from="field" field="Microsoft.VSTS.Common.ClosedBy" />
</FIELD>
</FIELDS>
</TRANSITION>
</TRANSITIONS>
</WORKFLOW>
<FORM>
<!-- Guidelines for updating the form section
1) All labels should have mnemonics (you must use &amp; not just &)
2) No mnemonics on Tabs or Group Boxes
3) Labels must use sentence casing (i.e. "Assigned to:" is correct; "Assigned To:" is wrong)
4) No colons in Group Boxes
5) Label names should match the field name in whole or in part. They should not be completely different.
6) Do not use the same mnemonics on two labels

The following mnemonics are common to MSF Agile work items:
T -> Title
A -> Area
I -> Iteration
G -> Assigned to
S -> State
R -> Reason
H -> Comment and history
U -> Issue
B -> Integration build
C -> Description
E -> Start Date
F -> Finish Date

The following mnemonics are also used on this work item type
D -> Discipline
K -> Rank
X -> Exit criteria
W -> Remaining work
P -> Completed work
O -> Task Context
-->
<Layout>
<Group>
<Column PercentWidth="70">
<Control Type="FieldControl" FieldName="System.Title" Label="&amp;Title:" LabelPosition="Left" />
</Column>
<Column PercentWidth="30">
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Common.Discipline" Label="&amp;Discipline:" LabelPosition="Left" />
</Column>
</Group>

<Group>
<Column PercentWidth="100">
<Control Type="FieldControl" FieldName="Yazgelistir.TakipID" Label="Takip ID" LabelPosition="Left" />
</Column>
</Group>

<Group Label="Classification">
<Column PercentWidth="100">
<Control Type="WorkItemClassificationControl" FieldName="System.AreaPath" Label="&amp;Area:" LabelPosition="Left" />
<Control Type="WorkItemClassificationControl" FieldName="System.IterationPath" Label="&amp;Iteration:" LabelPosition="Left" />
</Column>
</Group>
<Group Label="Status">
<Column PercentWidth="50">
<Control Type="FieldControl" FieldName="System.AssignedTo" Label="Assi&amp;gned to:" LabelPosition="Left" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Common.Rank" Label="Ran&amp;k:" LabelPosition="Left" NumberFormat="WholeNumbers" MaxLength="10" />
</Column>
<Column PercentWidth="50">
<Control Type="FieldControl" FieldName="System.State" Label="&amp;State:" LabelPosition="Left" />
<Control Type="FieldControl" FieldName="System.Reason" Label="&amp;Reason:" LabelPosition="Left" />
</Column>
</Group>
<TabGroup>
<Tab Label="Description">
<Control Type="HtmlFieldControl" FieldName="System.Description" Label="Des&amp;cription:" LabelPosition="Top" Dock="Fill" />
</Tab>
<Tab Label="History">
<Control Type="WorkItemLogControl" FieldName="System.History" Label="&amp;History:" LabelPosition="Top" Dock="Fill" />
</Tab>
<Tab Label="Links">
<Control Type="LinksControl" />
</Tab>
<Tab Label="File Attachments">
<Control Type="AttachmentsControl" />
</Tab>
<Tab Label="Details">
<Group>
<Column PercentWidth="50">
<Group Label="General">
<Column PercentWidth="100">
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Common.Issue" Label="Iss&amp;ue:" LabelPosition="Left" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Common.ExitCriteria" Label="E&amp;xit criteria:" LabelPosition="Left" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Build.IntegrationBuild" Label="Integration &amp;build:" LabelPosition="Left" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.TaskHierarchy" Label="Task C&amp;ontext:" LabelPosition="Left" ReadOnly="True" />
</Column>
</Group>
</Column>
<Column PercentWidth="50">
<Group Label="Schedule">
<Column PercentWidth="100">
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.RemainingWork" Label="Remaining &amp;work (hours):" LabelPosition="Left" NumberFormat="DecimalNumbers" MaxLength="10" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.CompletedWork" Label="Com&amp;pleted work (hours):" LabelPosition="Left" NumberFormat="DecimalNumbers" MaxLength="10" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.StartDate" Label="Start Dat&amp;e:" LabelPosition="Left" ReadOnly="True" />
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.FinishDate" Label="&amp;Finish Date:" LabelPosition="Left" ReadOnly="True" />
</Column>
</Group>
</Column>
</Group>
</Tab>
</TabGroup>
</Layout>
</FORM>
</WORKITEMTYPE>
</witd:WITD>

 

 

 

Work Item XML metadatasını import etmek(sunucuya yüklemek)

Work Item xml metadata dosyasını istediğimiz şekilde güncelledikten sonra aşağıdaki komut satırı ile Team Foundation Server içine import ediyoruz.

witimport /f c:\temp\task2.xml /t TFSERVER /p testproject1

Yukarıdaki komutu çalıştırıp işlemin başarı ile tamamlandığına dair bilgi mesajını aldıktan sonra Visual Studio 2005'i açıp Team Explorer penceresinden Work Item sağ tıklama menüsüne bakarsak Task2 adına yeni bir work item type eklendiğini görebiliriz.

Add Work Item menüsünden Task2 seçildiği takdirde Takip ID alanının form üzerine eklendiğini görebiliriz.

Work Item özelleştirmenin temellerini gösterdiğimiz bu makale ışığında kendi süreçlerinize göre ihtiyaçlarınızı belirleyip work item özelleştirmesine gidebilirsiniz.

Cengiz HAN
Microsoft MVP