Requirements in TFS

Customers are often asking about storing requirement documents with their requirement work item. Specifically what is the best way to do this? I always tell them they have 3 options. Before we talk about that keep in mind there are third party requirement management tools out there that integrate with TFS. Therefore there is a 4th option. Which is to use that tool and have it push requirements into TFS as a work items but store the full fidelity of the requirement in the requirement management tool itself. If you don’t have such a tool here are 3 other options.

Attachments

The simplest is to just attach your requirement document to the Work item using the attachments tab on the work item. The document is stored in the Database with the requirement and is easily found by others. This is difficult to version though. If you changed the requirement in another release you would have to alter the document and attach it again to another Work item so you can maintain the previous requirement as it was in the previous version.

Versioned Items

If you want to keep versions of the Requirement document you could store it in source control and create a link to it from the work item using a Versioned Item. Then you can point the Work item to a particular version of the document in source control using the Link Type Versioned Items.

Hyperlink

The third solution is to store the document in SharePoint. Where you can easily apply workflow to it and version it. Then link it to the Work Item via a Hyperlink link type.

Along the same lines, I was recently asked what if I wanted to change my requirement work item so there was a tab on the Requirement just for Hyperlinks to SharePoint, and remove the Attachments tab so documents can’t be added to the work item.

I’m not sure I would remove the attachments tab it can be handy for many things. However it’s easily removed from the UI. Adding a Tab just for Hyperlinks is a little trickier.

I’ll explain how to do this using the process editor that comes with the TFS power tools. Then also include the XML for the control.

Open the work item type using the process editor, and go to the layout tab.

Add a new Tab under the Tab Group and name it SharePoint Documents or something appropriate.

Create a new control on that Tab and change the control type to a LinksControl

On the Control Settings property click the ellipses button to open the editor. 

In the filter section there are three fields set them like this:

  • Work Item Type Filters – Exclude - Select all Work Item Types
  • Work item Link Filters – Exclude - Select all Work Item Filter Types
  • External Link Filters – Include – Workitem Hyperlink

Might as well remove all the columns except for Title and System.Links.Comment

Once you apply this change to your Project you will have a new tab that only allows Hyperlinks to be added.

As promised here is the XML for the new Tab with Links Control

<Tab Label="SharePoint Documents">
            <Control Type="LinksControl" Label="" LabelPosition="Left">
              <LinksControlOptions>
                <LinkColumns>
                  <LinkColumn LinkAttribute="System.Links.Comment" />
                  <LinkColumn RefName="System.Title" />
                </LinkColumns>
                <WorkItemLinkFilters FilterType="exclude">
                  <Filter LinkType="Microsoft.VSTS.Common.Affects" />
                  <Filter LinkType="System.LinkTypes.Hierarchy" />
                  <Filter LinkType="System.LinkTypes.Dependency" />
                  <Filter LinkType="System.LinkTypes.Related" />
                  <Filter LinkType="Microsoft.VSTS.TestCase.SharedStepReferencedBy" />
                  <Filter LinkType="Microsoft.VSTS.Common.TestedBy" />
                </WorkItemLinkFilters>
                <ExternalLinkFilters FilterType="include">
                  <Filter LinkType="Workitem Hyperlink" />
                </ExternalLinkFilters>
                <WorkItemTypeFilters FilterType="exclude">
                  <Filter WorkItemType="Bug" />
                  <Filter WorkItemType="Issue" />
                  <Filter WorkItemType="Shared Steps" />
                  <Filter WorkItemType="Task" />
                  <Filter WorkItemType="Test Case" />
                  <Filter WorkItemType="User Story" />
                </WorkItemTypeFilters>
              </LinksControlOptions>
            </Control>
          </Tab>