Link type element reference
You use different link types to form link relationships between different work item types (WITs). There are three categories of link types: system-defined, process-template defined, and user-defined. The link types defined in the default process templates support link relationships among the test management WITs.
Each link type defines the link labels, topology type, and restrictions that are used when links between work items are constructed. For example, the parent-child link type defines two labels (Parent and Child), supports a hierarchical or tree topology, and prevents circular references from being created between work items.
To customize or create a link type, use witadmin importlinktype to import the link type definition file to the project collection that hosts your team project.
Syntax structure
You can define additional link types by adding them to the link types that are defined for a team project collection. You can define valid link types for use in your process based on the structure that the link type definition schema provides. A link type is defined by the following XML syntax in the link types XML file:
<LinkTypes>
<LinkType ReferenceName="LinkTypeName" ForwardName="ForwardName" ReverseName="ReverseName" Topology="TopologyType" />
</LinkTypes>
The descriptions in the following table apply to the previous syntax:
Attribute |
Description |
---|---|
ReferenceName |
Name of the link type. This name is used internally when you create a link between two work items. |
ForwardName |
Name of the link at the source work item. This name appears when you add links to the source work item. |
ReverseName |
Name of the link at the target work item. This name appears when a listing of the links at the target work item appears. |
TopologyType |
Specifies the DirectedNetwork, Network, Tree, or Dependency topology. The first three topologies are directional, and you use them to define subordinate or sequential relationships. You use Network to define relationships between peers or where no implied subordination exists. |
Link directionality is determined by the assignments made to the ForwardName and ReverseName attributes. If you create a custom link and assign the same name to the forward and reverse names, you should set the link type to Network because it is the only non-directional topology.
Requirements
LINKTYPES is a set of LINKTYPE elements that are stored and used by a team project collection.
Each link type has a reference name and two optional friendly names, or name labels, which must be unique within the project collection. Each link type name must meet the following requirements:
Names can have up to 254 Unicode characters.
Names must not be empty.
Names cannot have leading or trailing white spaces.
Names cannot contain backslash (\) characters.
Names cannot contain two consecutive white spaces.
System-defined link types
The following table summarizes the system-defined link types. You cannot modify these link types.
Forward Name |
Reverse Name |
Reference name |
Topology |
---|---|---|---|
Successor |
Predecessor |
System.LinkTypes.Dependency |
Dependency |
Child |
Parent |
System.LinkTypes.Hierarchy |
Tree |
Related |
Related |
System.LinkTypes.Related |
Network |
In addition, there are additional link types used to link work items to other objects in the team project or other elements, such as a web page or network location. For example, the Storyboard link type links work items to storyboards or any file located on a network share. For more information, see Link work items to support traceability.
Process-template defined link types
When you create a team project using one of the default process templates that TFS provides, the following link types are added to your team project. These link types are specifically designed to support interaction with tracking work items in Team Foundation and Microsoft Test Manager.
Forward Name |
Reverse Name |
Link type reference name |
Topology |
---|---|---|---|
Affects (See Note 1) |
Affected By |
Microsoft.VSTS.Common.Affects |
Dependency |
Referenced By (See Note 2) |
References |
Microsoft.VSTS.TestCase.SharedParameterReferencedBy |
Dependency |
Tested By |
Tests |
Microsoft.VSTS.Common.TestedBy |
Dependency |
Test Case |
Shared Steps |
Microsoft.VSTS.TestCase.SharedStepReferencedBy |
Dependency |
Notes
The Affects/Affected By link type links Change Requests to Requirements. This link type is only added to team projects that are created with a CMMI process template.
The Referenced By/References link type links Shared Parameter with Test Case to support running tests with different data. This link type is added to a team project when you update the team project using the Configure Features wizard or you create a team project based on a TFS 2013.2 process templates or later version.
Link type definition files are defined in the WorkItem Tracking\LinkTypes folder of the Template.zip file. The following definition for the Microsoft.VSTS.Common.TestedBy link type is defined in the TestedBy.xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinkTypes>
<LinkType ReferenceName="Microsoft.VSTS.Common.TestedBy" ForwardName="Tested By" ReverseName="Tests" Topology="Dependency" />
</LinkTypes>
When you create the team project by using the corresponding process template, the link type definition is imported into the project collection.
Link restrictions and topologies
The topology types described in the following table determine the restrictions placed on the usage of each link type.
Topology type |
Illustration |
---|---|
Network: You can use network links to create basic relationships between work items that are non-restrictive. The link is the same at both end points. Circular relationships are allowed. Example usage: Use a network link, such as Related, to record a relationship between two features that might share dependencies. |
|
Directed Network: You can use directed network links to create relationships between work items that indicate directionality. The link name is different at the end points. Circular relationships are allowed. Example usage: Use a directed network link to record a relationship between two features that might share dependencies and which you want to distinguish from each other in some way. |
|
Dependency: You can use dependency links to create relationships between work items that have directionality and to restrict circular relationships. The link name is different at the end points. In the illustration, you cannot create a dependent link to a work item that contains dependent link relationships to the same work items. Example usage: Use a dependency link to record the features that must be completed to deliver a user requirement. |
|
Tree: You can use tree links to create multi-level hierarchical relationships among work items. Tree links support multi-level hierarchical views, have directionality, and restrict circular relationships. The link name is different at the end points. Tree links are the only type of link that is supported by the Tree of Work Items query. In the illustration, you cannot assign two parents to a child. Example usage: Use a tree link to record tasks and subtasks from your team that must be completed to deliver a feature. |
Link types schema definition
The following code lists the schema definition for link types:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
id="WorkItemLinkTypeDefinition"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://schemas.microsoft.com/VisualStudio/2005/workitemtracking/WorkItemLinkTypeDefinition.xsd"
xmlns="https://schemas.microsoft.com/VisualStudio/2005/workitemtracking/WorkItemLinkTypeDefinition.xsd"
xmlns:mstns="https://schemas.microsoft.com/VisualStudio/2005/workitemtracking/WorkItemLinkTypeDefinition.xsd"
xmlns:typelib="https://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typelib"
version="1.0">
<xs:import namespace="https://schemas.microsoft.com/VisualStudio/2005/workitemtracking/typelib"/>
<xs:simpleType name="TopologyTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="Network" />
<xs:enumeration value="DirectedNetwork" />
<xs:enumeration value="Dependency" />
<xs:enumeration value="Tree" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="LinkTypeType">
<xs:attribute name="ReferenceName" type="typelib:ReferenceName" use="required" />
<xs:attribute name="Topology" type="TopologyTypes" use="optional" />
<xs:attribute name="ForwardName" type="typelib:FriendlyName" use="optional" />
<xs:attribute name="ReverseName" type="typelib:FriendlyName" use="optional" />
</xs:complexType>
<xs:complexType name="LinkTypesType">
<xs:sequence>
<xs:element name="LinkType" type="LinkTypeType" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="LinkTypes" type="LinkTypesType" />
</xs:schema>
Q & A
Q: How do I add a custom link type?
A: Define an XML definition file according to the content provided in this topic and then use witadmin importlinktype to import the link type definition file to the project collection that hosts your team project.
Q: What link type is used to link test cases to test suites and test suites to test plans?
A: Using Team Web Access or Test Manager, you can view which test cases are defined for a test suite, and which test suites are defined for a test plan. However, these objects aren’t linked to each other through link types.
See Also
Concepts
Customize work tracking objects to support your team's processes