Introduction To Work Item Customisation

9,225 views

Published on

Published in: Business, Technology
  • Be the first to comment

Introduction To Work Item Customisation

  1. 1. QLD VSTS Users Group – February Meeting
  2. 3. Presented by William Bartholomew
  3. 4. William Bartholomew <ul><li>Is the Developer Productivity Specialist at TechnologyOne . </li></ul><ul><li>Improves developer productivity through education, processes and tools and implementing Visual Studio Team System is a key aspect of this. </li></ul><ul><li>Has been developing software solutions for 9 years primarily using Visual Studio, the .NET Framework and SQL Server . </li></ul><ul><li>Was a technical reviewer for the 2nd Edition of Steve McConnell's Code Complete as well as Volume 2 of Brad and Tamara Abram's .NET Standard Library Annotated Reference . </li></ul><ul><li>Is a member of: </li></ul><ul><ul><li>ACM (Association for Computing Machinery) </li></ul></ul><ul><ul><li>IEEE (Institute of Electrical and Electronics Engineers, Inc.) </li></ul></ul><ul><ul><li>IEEE Computer Society and IEEE Standards Association (IEEE-SA) </li></ul></ul><ul><ul><li>Microsoft User Interface Framework Advisory Council (ASP .NET, Windows Forms, WPF, etc.) </li></ul></ul>
  4. 5. Agenda <ul><li>Introduction </li></ul><ul><li>Adding a Field </li></ul><ul><ul><li>Exporting a Work Item Type </li></ul></ul><ul><ul><li>Adding a System Field </li></ul></ul><ul><ul><li>Defining a New Field </li></ul></ul><ul><ul><li>Modifying the Form </li></ul></ul><ul><ul><li>Verifying and Importing a Work Item Type </li></ul></ul><ul><li>Customising Workflow </li></ul><ul><li>Defining Business Rules </li></ul><ul><li>Defining New Work Item Types </li></ul><ul><li>Customising Work Item Web Page </li></ul><ul><li>Real-World Examples </li></ul><ul><li>Conclusion </li></ul>
  5. 6. Introduction <ul><li>Process templates ship with a number of work item types: </li></ul><ul><ul><li>Agile – Bug, Quality of Service Requirement, Risk, Scenario, Task </li></ul></ul><ul><ul><li>CMMI – Bug, Change Request, Issue, Requirement, Review, Risk, Task </li></ul></ul><ul><li>You can customise existing work item types. </li></ul><ul><li>Or, you can create your own work item types. </li></ul>
  6. 7. Introduction <ul><li>Work item types are defined using XML. </li></ul><ul><li>Defines the fields, workflow and form layout for a work item type. </li></ul><ul><li>Schema documented in the Team Foundation Administrator’s Guide: </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/aa337661(VS.80).aspx </li></ul></ul>
  7. 8. Demo
  8. 9. Adding a Field <ul><li>Export the work item type you want to add the field to. </li></ul><ul><li>Define the field. </li></ul><ul><li>Verify the work item type. </li></ul><ul><li>Import the work item type. </li></ul><ul><li>Refresh the work item type cache. </li></ul><ul><li>Test. </li></ul>
  9. 10. Exporting a Work Item Type <ul><li>witexport.exe </li></ul><ul><ul><li>/f <Filename> </li></ul></ul><ul><ul><li>/t <TeamFoundationServerName> </li></ul></ul><ul><ul><li>/p <TeamProjectName> </li></ul></ul><ul><ul><li>/n <WorkItemTypeName> </li></ul></ul><ul><ul><li>Optionally: /exportgloballists </li></ul></ul>
  10. 11. Adding a System Field <ul><li>System fields always exist for all work item types. </li></ul><ul><ul><li>Used for cross work item type queries. </li></ul></ul><ul><li>List system fields: </li></ul><ul><ul><li>TFS Administrator’s Guide </li></ul></ul><ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms194971(VS.80).aspx </li></ul></ul></ul><ul><ul><li>witfields.exe view </li></ul></ul><ul><li>System fields can be explicitly referenced in work item types. </li></ul><ul><ul><li>The definition must match the field’s existing definition. </li></ul></ul><ul><ul><li>Allows defining different business rules in different work item types. </li></ul></ul>
  11. 12. Using an Existing Field <ul><li>Allows you to use fields from other process templates (e.g. use a CMMI field in an Agile project) or from other work-item types. </li></ul><ul><li>Same process for using a system field. </li></ul>
  12. 13. Defining a New Field – Name <ul><li>What’s in a name? </li></ul><ul><ul><li>Field Name </li></ul></ul><ul><ul><ul><li>User visible </li></ul></ul></ul><ul><ul><ul><li>Free form text </li></ul></ul></ul><ul><ul><ul><li>Can be changed by the Team Foundation Server administrator </li></ul></ul></ul><ul><ul><li>Reference Name </li></ul></ul><ul><ul><ul><li>Used internally and for integration (APIs etc.) </li></ul></ul></ul><ul><ul><ul><li>Free form text </li></ul></ul></ul><ul><ul><ul><li>Best practice is to use namespace format (e.g. T1.Adf.ReleaseNotes) </li></ul></ul></ul><ul><ul><ul><li>Can’t be changed </li></ul></ul></ul><ul><li>You can specify help text using the HELPTEXT element. </li></ul>
  13. 14. Defining a New Field – Type <ul><li>Choose a type </li></ul><ul><ul><li>String (single line up to 255 characters) </li></ul></ul><ul><ul><li>Integer </li></ul></ul><ul><ul><li>Double </li></ul></ul><ul><ul><li>DateTime </li></ul></ul><ul><ul><li>PlainText (multi-line string) </li></ul></ul><ul><ul><li>HTML (multi-line string with formatting) </li></ul></ul><ul><ul><li>History (discussion thread and change log) </li></ul></ul><ul><ul><li>TreePath (used for iteration and area only) </li></ul></ul><ul><li>Can’t be changed once the field is added </li></ul>
  14. 15. Defining a New Field – Reporting <ul><li>Reporting for duty Sir! Specified using “reportable” attribute: </li></ul><ul><ul><li>Not Specified – Won’t be included in the warehouse </li></ul></ul><ul><ul><li>Dimension – Included in the warehouse as a categorization </li></ul></ul><ul><ul><li>Detail – Included in the warehouse but not the cube </li></ul></ul><ul><ul><li>Measure – Included in the warehouse as an aggregate (sum) </li></ul></ul><ul><li>Can’t be changed once set. </li></ul><ul><li>Setting the value only affects new work items, existing work items won’t be updated in the warehouse unless modified. </li></ul>
  15. 16. Defining a New Field – Changing <ul><li>If you need to change one of the attributes that is not changeable then you must remove and re-add the field definition. </li></ul><ul><ul><li>This requires removing it from ALL work item types referencing it. </li></ul></ul><ul><ul><li>Any data stored in the field will be lost. </li></ul></ul><ul><li>Try to get the field definition correct from the beginning. </li></ul>
  16. 17. Defining a New Field – Example <ul><li><FIELD name=&quot;Category&quot; refname=&quot;MyCompany.MyProcess.MyField&quot; type=&quot;String&quot; reportable=&quot;Dimension“ /> </li></ul>
  17. 18. Modifying the Form – Layout <ul><li>Group </li></ul><ul><ul><li>Must contain at least one column. </li></ul></ul><ul><ul><li>Has a border. </li></ul></ul><ul><ul><li>Has an optional label. </li></ul></ul><ul><ul><li>Multiple groups are “stacked”. </li></ul></ul><ul><li>Column </li></ul><ul><ul><li>Allows you to arrange controls side by side. </li></ul></ul><ul><ul><li>Supports a splitter to allow resizable columns. </li></ul></ul><ul><li>TabGroup and Tab </li></ul><ul><ul><li>Creates a typical tab control. </li></ul></ul>
  18. 19. Modifying the Form – Main Controls <ul><li>FieldControl </li></ul><ul><ul><li>Single line. </li></ul></ul><ul><ul><li>Best for String, Integer, Double and DateTime data types. </li></ul></ul><ul><ul><li>Rendered as either a text box or a combo box. </li></ul></ul><ul><li>HtmlFieldControl </li></ul><ul><ul><li>Multi-line. </li></ul></ul><ul><ul><li>Best for PlainText and HTML data types. </li></ul></ul><ul><ul><li>Supports formatting (if the field does). </li></ul></ul>
  19. 20. Modifying the Form – Other Controls <ul><li>TFStructureControl </li></ul><ul><ul><li>Only used for Area and Iteration (i.e. TreePath fields). </li></ul></ul><ul><ul><li>Rendered as a tree combo. </li></ul></ul><ul><li>WorkItemLogControl </li></ul><ul><ul><li>Only used for History. </li></ul></ul><ul><ul><li>Rendered as a date/time stamped list. </li></ul></ul><ul><ul><li>Also contains change log. </li></ul></ul><ul><li>LinksControl </li></ul><ul><ul><li>Used to link work items to other artefacts and/or hyperlinks. </li></ul></ul><ul><ul><li>Doesn’t have a “backing” field. </li></ul></ul><ul><li>AttachmentsControl </li></ul><ul><ul><li>Used to link work items to arbitrary files. </li></ul></ul><ul><ul><li>Doesn’t have a “backing” field. </li></ul></ul>
  20. 21. Modifying the Form – Custom Controls <ul><li>Standard Windows user control. </li></ul><ul><li>Implements IWorkItemControl from Microsoft.TeamFoundation.WorkItemTracking.Controls.dll. </li></ul><ul><li>Special XML file called <ControlName>.wicc tells Visual Studio where to load the control from. </li></ul><ul><li>DLL must be deployed on all developer workstations. </li></ul><ul><li>All developer workstations must be running Service Pack 1. </li></ul><ul><li>More information: </li></ul><ul><ul><li>http://blogs.msdn.com/narend/archive/2006/10/02/How-to-use-Custom-Controls-in-Work-Item-Form.aspx </li></ul></ul>
  21. 22. Verify and Import Work Item Type <ul><li>witimport.exe </li></ul><ul><ul><li>/f <Filename> </li></ul></ul><ul><ul><li>/t <TeamFoundationServerName> </li></ul></ul><ul><ul><li>/p <TeamProject> </li></ul></ul><ul><li>Verify rather than import: </li></ul><ul><ul><li>/v </li></ul></ul><ul><li>Work item type definitions are cached by Visual Studio so you will need to refresh Team Explorer. </li></ul>
  22. 23. Demo
  23. 24. Customising Workflow – Introduction <ul><li>States </li></ul><ul><ul><li>Rules </li></ul></ul><ul><li>Transitions </li></ul><ul><ul><li>From State </li></ul></ul><ul><ul><li>To State </li></ul></ul><ul><ul><li>Reasons </li></ul></ul><ul><ul><li>Rules </li></ul></ul><ul><li>Initial states are those with a transition from the “” (null) state. </li></ul>
  24. 25. Customising Workflow – In Practice <ul><li>The work item editor shows a list of transitions with the work item’s current state as the from state. </li></ul><ul><li>When changing state: </li></ul><ul><ul><li>Must choose from one of the reasons associated with the transition. </li></ul></ul><ul><ul><ul><li>A default is used by default if an alternate isn’t chosen. </li></ul></ul></ul><ul><ul><li>Must meet any business rules associated with the transition and destination state. </li></ul></ul>
  25. 26. Customising Workflow – Security <ul><li>Transitions can be restricted by security group: </li></ul><ul><ul><li>“for” attribute – Allow a group </li></ul></ul><ul><ul><li>“not” attribute – Deny a group </li></ul></ul><ul><ul><li>“not” has a higher precedence than “for”. </li></ul></ul>
  26. 27. Customising Workflow – Integration <ul><li>When assigning work items to a changeset you can choose which transitions to execute on the assigned work items. </li></ul><ul><li>When customising a work item type you can choose which transitions are eligible for this functionality: </li></ul><ul><ul><li><ACTIONS> <ACTION value=&quot;Microsoft.VSTS.Actions.Checkin&quot; /> </ACTIONS> </li></ul></ul>
  27. 28. Demo
  28. 29. Defining Business Rules – Available Rules <ul><li>Required </li></ul><ul><li>ReadOnly </li></ul><ul><li>Empty </li></ul><ul><li>Frozen </li></ul><ul><li>CannotLoseValue </li></ul><ul><li>NotSameAs </li></ul><ul><li>ValidUser </li></ul><ul><li>AllowExistingValue </li></ul><ul><li>Match </li></ul>
  29. 30. Defining Business Rules – Defaults <ul><li>Default </li></ul><ul><ul><li>Only used if the field is empty. </li></ul></ul><ul><ul><li>Field </li></ul></ul><ul><ul><li>Value </li></ul></ul><ul><ul><li>Clock </li></ul></ul><ul><ul><li>CurrentUser </li></ul></ul><ul><li>Copy </li></ul><ul><ul><li>Always used. </li></ul></ul><ul><ul><li>Field </li></ul></ul><ul><ul><li>Value </li></ul></ul><ul><ul><li>Clock </li></ul></ul><ul><ul><li>CurrentUser </li></ul></ul><ul><li>ServerDefault </li></ul><ul><ul><li>Default is always used, field appears read-only on form. </li></ul></ul><ul><ul><li>Clock </li></ul></ul><ul><ul><li>CurrentUser </li></ul></ul>
  30. 31. Defining Business Rules – Lists <ul><li>Lists: </li></ul><ul><ul><li>AllowedValues </li></ul></ul><ul><ul><li>SuggestedValues </li></ul></ul><ul><ul><li>ProhibitedValues </li></ul></ul><ul><li>Using AllowedValues results in a DropDownList, otherwise a Combo. </li></ul><ul><li>Values can be enumerated in the list definition. </li></ul><ul><li>Or, can be stored in a global list which can be reused. </li></ul><ul><li>Global lists can be exported with glexport or using the /exportgloballists switch on witexport. </li></ul><ul><li>Global lists can be imported with glexport or as part of a work item type using witimport. </li></ul>
  31. 32. Defining Business Rules – Where Used <ul><li>Rules can be nested inside: </li></ul><ul><ul><li>Field – The rule must always pass. </li></ul></ul><ul><ul><li>State – The rule must always pass when the work item is in this state. </li></ul></ul><ul><ul><li>Transition – The rule must pass when the work item is moved using this transition. </li></ul></ul><ul><ul><li>Reason – The rule must pass if the reason is used. </li></ul></ul>
  32. 33. Defining Business Rules - Conditional <ul><li>Conditional rules: </li></ul><ul><ul><li>“ for” attribute – Defines the security groups that the rule applies to </li></ul></ul><ul><ul><li>“ not” attribute – Defines the security groups exempt from the rule </li></ul></ul><ul><ul><li>“ not” has a higher precedence than “for”. </li></ul></ul><ul><li>WHEN element – Apply rules based on the value of a field being equal to a value. </li></ul><ul><li>WHENNOT element – Apply rules based on the value of a field not being equal to a value. </li></ul><ul><li>WHENCHANGED element – Apply rules only if a field has changed. </li></ul>
  33. 34. Demo
  34. 35. Defining New Work Item Types <ul><li>Simply combine all these concepts into a new XML file. </li></ul><ul><li>Beware, work item types cannot be deleted or renamed! </li></ul><ul><li>Always test in a sandpit project or even better server. </li></ul><ul><li>Store your work item type definitions in Source Control so you can track changes. </li></ul>
  35. 36. Demo
  36. 37. Customising Work Item Web Page – Before <ul><li>Available by going to: </li></ul><ul><ul><li>http://server:8080/WorkItemTracking/WorkItem.aspx?artifactMoniker=<WorkItemNumber> </li></ul></ul>
  37. 38. Customising Work Item Web Page <ul><li>Generated by XSL: %ProgramFiles% Microsoft Visual Studio 2005 Team Foundation Server Web ServicesWorkItemTracking v1.0TransformsWorkItem.xsl </li></ul><ul><li>Backup the original XSL. </li></ul><ul><li>Backup your new XSL. It may be overwritten by service packs, upgrades, etc. </li></ul>
  38. 39. Demo
  39. 40. Real-World Examples <ul><li>TechnologyOne </li></ul><ul><ul><li>Customised the agile work item types to include fields for storing Release Notes. </li></ul></ul><ul><ul><li>Customised the task workflow to mimic the bug workflow. </li></ul></ul><ul><ul><li>Custom work item types for tracking QA issues. </li></ul></ul><ul><li>Conchango </li></ul><ul><ul><li>Have created a set of custom work item types for the Scrum methodology. </li></ul></ul><ul><ul><li>http:// scrumforteamsystem.com </li></ul></ul>
  40. 41. Real-World Examples – Microsoft
  41. 42. Real-World Examples – Microsoft
  42. 43. Real-World Examples – Microsoft
  43. 44. Conclusion <ul><li>Just do it! </li></ul>
  44. 45. <ul><li>Teamprise 2.0 </li></ul>
  45. 46. <ul><li>Teamprise is a suite of client applications for accessing Microsoft Visual Studio 2005 Team Foundation Server from outside of the Visual Studio Integrated Development Environment (IDE). </li></ul><ul><li>Teamprise enables software development teams to use the source control, work item tracking, documents, and reporting features of Team Foundation Server from within the Eclipse IDE, and from other operating systems, including Linux and Mac OS X. </li></ul><ul><li>A big thanks to our friends at Teamprise for their support of our user group. Visit them at http:// www.teamprise.com </li></ul>
  46. 47. <ul><li>Contributor Prize </li></ul><ul><ul><li>free license of Teamprise 2.0 valued at USD$499 </li></ul></ul><ul><li>Member Discount </li></ul><ul><ul><li>QVSTSUG members get a 12% discount when purchasing on-line from our website ( http:// www.stpsoft.co.uk/vsts ). To use the discount, enter the coupon code QVUG015 on the on-line order form screen. </li></ul></ul>

×