Enabling Requirement based suites for other work item types (without putting them on your backlog pages)

2014-12-20

A few weeks ago a client asked me whether they could link test cases to the Feature and Epic work items and whether they could create a Requirements Based Suite for these work items in Test manager. And while investigating the new "Bug on the Backlog" feature of TFS 2013 update 4 I found that there is a bug preventing MTM from showing bugs for requirements based suites. This little trick works for both problems.

Initially I thought it would not be possible, The work items that would show up in MTM needed to be in the Requirements Category and that is also the category that governs which work item types show up on the Backlog. Since Features can't be both in the Requirements Backlog and the Feature Backlog, I initially gave up.

Then I got an email from Martin Hinshelwood with hint of where to look. The ProcessConfiguration.xml allows you to decouple the Requirements Backlog from the Requirements Category. With these items decoupled, it would be possible to stick any work item in the "Requirements Category" without them showing up on the Product backlog.



This trick also solves the bug that was introduced in TFS 2013.4 that hides Bugs in MTM when you try to add a Requirements Based Suite.

To make this all work you need the Categories.xml and the ProcessConfiguration.xml from your process template. Either use a template you've downloaded from your TFS server, or export these files from a live project:

C:\Temp>witadmin exportcategories /collection:http://jessehouwing:8080/tfs/DemoCollection /p:"Scrum 2013.3" /f:categories.xml
Operation complete.

C:\Temp>witadmin exportprocessconfig /collection:http://jessehouwing:8080/tfs/DemoCollection /p:"Scrum 2013.3" /f:processconfiguration.xml
Operation complete.

With the files exported open up the Categories.xml and add a new category that will hold the items for your Product Backlog (I called it Custom.PlanningCategory):
<CATEGORY refname="Custom.PlanningCategory" name="Planning Category">
  <DEFAULTWORKITEMTYPE name="Product Backlog Item" />
  <!-- Remove bugs if you want to enable the Bug on the Backlog feature -->
  <WORKITEMTYPE name="Bug" />
</CATEGORY>

And add all work item types you want to enable for MTM Requirements based suites to the Microsoft.RequirementsCategory:
<CATEGORY name="Requirement Category" refname="Microsoft.RequirementCategory">
  <DEFAULTWORKITEMTYPE name="Product Backlog Item" />
  <WORKITEMTYPE name="Bug" />
  <WORKITEMTYPE name="Feature" />
</CATEGORY>

Then open up the ProcessConfiguration.xml and change the mapping of the RequirementsBacklog to your new category:
<RequirementBacklog category="Custom.PlanningCategory" parent="Microsoft.FeatureCategory" pluralName="Backlog Items" singularName="Backlog Item">
  ...
</RequirementBacklog>>

Import both items back into your project to enable the new configuration:
C:\Temp>witadmin importcategories /collection:http://jessehouwing:8080/tfs/DemoCollection /p:"Scrum 2013.3" /f:categories.xml
Operation complete.

C:\Temp>witadmin importprocessconfig /collection:http://jessehouwing:8080/tfs/DemoCollection /p:"Scrum 2013.3" /f:processconfiguration.xml
Operation complete.

If you're adding the new work item types to the Requirements Category, you might want to edit their form definition to show the "Tests" tab. You can copy the definition for this work item control from the "Product Backlog" work item:
<Tab Label="Test Cases">
  <Control Type="LinksControl" Label="" LabelPosition="Top" Name="TestedBy">
    <LinksControlOptions>
      <LinkColumns>
        <LinkColumn RefName="System.Id" />
        <LinkColumn RefName="System.WorkItemType" />
        <LinkColumn RefName="System.Title" />
        <LinkColumn RefName="System.AssignedTo" />
        <LinkColumn RefName="System.State" />
      </LinkColumns>
      <WorkItemLinkFilters FilterType="include">
        <Filter LinkType="Microsoft.VSTS.Common.TestedBy" FilterOn="forwardname" />
      </WorkItemLinkFilters>
      <ExternalLinkFilters FilterType="excludeAll" />
      <WorkItemTypeFilters FilterType="include">
        <Filter WorkItemType="Test Case" />
      </WorkItemTypeFilters>
    </LinksControlOptions>
  </Control>
</Tab>
 

Most Reading