Link work items to support traceability and manage dependencies
VSTS | TFS 2018 | TFS 2017 | TFS 2015 | TFS 2013
By linking work items and other objects, you can track related work, dependencies, and changes made over time. All links are defined with a specific link type. For example, you can use Parent/Child links to link work items to support a hierarchical tree structure. Whereas, the Commit and Branch link types support links between work items and commits and branches, respectively.
In a nutshell, you can:
- Link work items to other work items
- Link work items to test cases, and test cases to other test items and test results
- Link work items to code-related objects such as branches, commits, pull requests, and more
- Link select git code-related objects to builds
- Link work items to a web address or to a storyboard or a document on a network share
- Link work items to architecture diagrams (requires Visual Studio Enterprise edition).
Below, you can learn how to link objects and which link types to use. You can link objects from the web portal or Visual Studio Team Explorer.
Feature availability: Work item forms and features available to you can differ depending on whether you connect to VSTS or an on-premises Team Foundation Server (TFS), and whether you open the form from the web portal or Visual Studio Team Explorer.
This topic describes the link types available for your use. For details on linking work items, see Add link to work items.
Link work items to other work items
There are several system link types used to link work items to each other: two tree topology, one dependency topology, and one network as indicated in the table. Tree topology links support nested hierarchies, tree queries, and several reports. Dependent links support tracking tasks that must be completed before others can be started. And, the Related link type supports connecting work items that are at the same level.
All two-way link types are characterized by a Forward and Reverse name, such as Parent/Child and Duplicate/Duplicate Of. When you link using one of these names, the linked work item is updated to include a link with the corresponding link type. For example, if you add a Parent link to a work item, the linked work item contains a Child link.
As a quick reference guide, use the following link types as indicated:
- Use the Duplicate link type when two work items have been created that essentially capture the same information; close one of the work items and keep the other one active
- Use the Parent/Child link types when you want to break down work items into smaller items—for example, break down features into stories, or stories into tasks
- Use Predecessor-Successor link types when you want to track tasks that must be completed before others can be started; this link type is most often used when you plan work using Project
- Use the Related link type when the work items being linked are at the same level—such as two user stories that define features that overlap one another—or to link work items that are defined in different team projects or managed by different teams.
For additional guidance on choosing link types, review the Link type descriptions and guidance in the related notes section.
You can create links from within a work item form, from a work item that appears in a list of query results, in Microsoft Excel, or in Microsoft Project. You can also use any of the client programs for Team Foundation, such as Team Explorer and the web portal, to create links or attach files.
Also, you can use the context menu in the web portal or Team Explorer.
For each work item, you can add a maximum of 1000 links to other work items.
Add a link from one work item to another work item
You can create links between work items by using one of the links control tabs within a work item form. The user interface to link a work item differs based on the platform, version, and client you use. To link several work items to a new or existing item, see Add link to work items.
From the new work item form, you can add a link using the Related Work section or from the Links tab.
Open a work item and click the icon to add a link.
Choose Existing item to link to a work item or other object using any supported link type. Choose New item to initiate a link and define a new work item at the same time. For details, see Add link to work items.
From the Related Work or Links tab, you can also perform these actions:
- Open an associated item or object: click the linked item
- Delete a link: highlight it and click the delete icon
From a query results page, you can also perform these actions:
- Link selected items to a new work item
- Link selected items to an existing work item
For details, see Add link to work items.
The new web form is only available from TFS 2017 and later versions.
Link or change parent-child links between work items
These features let you quickly link or change links that use the parent-child link type:
- To link backlog items to portfolio backlog items or to change the link structure among these items, use the mapping pane to organize your backlog.
- To create and link tasks to backlog items, use the sprint backlog page; from the web portal you can also drag-and-drop items to change the link structure.
- To indent (), outdent (), and change the link structure of a tree hierarchy, you can re-parent and reorder items from a backlog in the web portal or use a tree query in Team Explorer.
Link test cases, shared steps, and test results
You can link work items to test cases using the Tested/Tested By link types. You use the same link controls you use to link work items to other work items as described earlier.
The following image shows the full set of link types used in linking test management work item types. most links between test management artifacts occur by executing a task from the Test pages or Microsoft Test Manager.
For example, when you add Shared Steps to a Test Case, they are automatically linked using the Test Case/Shared Steps link types. See Share steps between test cases.
Test case work item form (web portal for TFS 2015)
From Test you can add test plans, test suites, and test cases—which are linked, but not through a specific link type. Also, the test system creates and manages the associations of test results to test cases and test plans.
Link work items, code artifacts, and builds
As you develop your software, you can capture which code changes and builds support the completion of a work item. In this way, your team can understand what work was done or how a bug was fixed through the audit trail of changes to the code base.
The link types used to construct these links—as illustrated in the following image—are: Branch, Build, Changeset, Commit, Found in build, Integrated in build, Pull Request, and Versioned Item.
The link types used to construct these links—as illustrated in the following image—are: Branch, Build, Changeset, Commit, Pull Request, and Versioned Item.
To learn more about the links control or to customize the Development links control, see LinksControlOptions elements, Development links control.
You can add a link from the work item to the supported artifacts using the method described earlier for linking work items. However, an easier method is to add the work item ID to a commit, pull request, changeset, or other supported Git or TFVC operation at the time you create those items. Also, you can link work items from the Development section within the new work item form.
Link work items and Git code development
The recommended method is to drive development from the work item or add the work item ID when creating branches, commits (git), changesets (TFVC), pull requests (git).
Git lets you link work items to commits by using the Commit link type. You can do this in several ways:
- In Visual Studio Team Explorer, add work item IDs before you commit your changes
- You can use the git-commit command and include the work item ID in your comment. For example, you apply this comment #35 Catch null exception to your commit. When you push the commit, the system creates a Commit link between the commit and work item #35.
And, with the new work item form (available from VSTS and TFS 2017), you can drive your git development from the work item as shown in the following image.
Link work item and TFVC code development
Team Foundation version control (TFVC) lets you link work items to version control changesets or versioned source code files by using the Changeset and Versioned Item link types. When you check in pending changes or use My Work to check in changes, work items are automatically linked to your changes.
Link to a Web site, network share, storyboard, or document
You can use the Hyperlinks or Storyboard link type to link a work item to a Web site, network share, or document located on a network share. Both of these link types are one-way links. To add links of this type, you can use the same links controls described earlier for linking work items.
From the Storyboards tab, you can link storyboards that you created using PowerPoint Storyboarding or other application. The Storyboards tab and links control is available from the web and client work item form for TFS 2015.
For process templates associated with TFS 2015 and earlier versions, the Storyboards tab links control was added to those work item types used to defined requirements, user stories, or features. When you make changes to a linked storyboard, the work item continues to link to the file with the latest changes.
By using the Storyboard link type, you differentiate the link your adding to specify a storyboard or document that provides work item specifications. Use this link type to provide your team access to the shared file where they can add their comments. You can also link from a Power Point file to a work item using this link type as described in Storyboard your ideas using PowerPoint.
Link work items to architectural diagrams
You choose the Model link type when you want to link a work item to an architectural diagram created using Visual Studio Enterprise. This link type is only available when you work from Visual Studio Enterprise. With this link type, you can track tasks, test cases, bugs, requirements, issues, or other kinds of work that are associated with specific parts of your model.
To link a work item to a diagram, open the work item in Visual Studio, choose the All Links or Other Links tab and choose the Model link type. You can also open the linked diagram from the links tab.
Or, you can link a model element to a work item. See Link model elements and work items.
Query for linked work items
To filter items based on hierarchical links, use the Tree of work items query type. To filter items based on all link types, use Work items and direct links.
You can search for work items that not only meet criteria for field values but also that are linked to other work items with specific types of links. This kind of query displays a primary set of work items, which meet the field criteria, and a secondary set, which are linked to items in the primary set.
For query examples, see Link and attachment queries.
You can't construct a query that shows a hierarchical view of Test Plans, Test Suites, and Test Cases. These items aren't linked together using Parent/Child or any other link type. You can only view the hierarchy through the Test>Test Plans page.
Link type descriptions and guidance
Link types you use to link work items are subject to certain restrictions based on their topology. Use the guidance provided in the following table to choose which link type to use based on the types of queries and reports you'll want to create. To learn more about link type restrictions and topologies, see LinksControlOptions elements.
(Dependency topology, CMMI only)
Use this directional link to create links between any set of work items, but not ones that would create closed loops. Typically used to track change requests made to requirements.Restrictions and recommendations:
Use this directional link to create one-to-many relationships between a single parent to one or more child items. Typical uses include:
Use this directional link to create one-to-many relationships between a single parent to one or more child items. Use to track tasks, bugs, or other work items which are duplicates of one another.
Restrictions and recommendations:
Use this directional link to create links between any set of work items, but not ones that would create closed loops. Typically used to track work that must be completed prior to beginning work on predecessor items.
|Use this non-directional link to create links between any set of work items.
Link test cases to work items, such as bugs, user stories, requirements, and product backlog items. For on-premises TFS, there are several SQL reports that depend on these links. See Review team activities to support useful reports
|Test Case-Shared Steps
Use to link test cases to shared steps. To learn more, see Share steps between test cases.
Use to link test cases to shared parameters. To learn more, see Repeat a test with different data.
You should now have a broad understanding of the various link relationships you can create to track dependencies and create an audit trail for your code development.
Once you've formed a link relationship, you can't edit the link type of that relationship from the web portal, but you can do it from Team Explorer.
For additional information, see these topics:
- Add link to multiple work items
- Share plans, add attachments
- Use mapping to link backlog items to features and epics
- Bulk modify links using Excel
Visualize related work and other objects
You can view related work items and object within a work item form by installing the Work item visualization extension available from the Visual Studio Marketplace.