連結、追蹤和管理相依性Linking, traceability, and managing dependencies

Azure Boards |Azure DevOps Server 2020 |Azure DevOps Server 2019 |TFS 2018-TFS 2013Azure Boards | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - 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
  • 將選取與 git 程式碼相關的物件連結至組建Link select git code-related objects to builds
  • 將工作專案連結至 web 位址或網路共用上的分鏡腳本或檔Link work items to a web address or to a storyboard or a document on a network share
  • (需要 Visual Studio Enterprise edition) ,將工作專案連結至架構圖表。Link work items to architecture diagrams (requires Visual Studio Enterprise edition).

本文描述可供您使用的連結類型。This article describes the link types available for your use. 您可以從入口網站或 Visual Studio Team Explorer 連結化物件。You can link objects from the web portal or Visual Studio Team Explorer. 如需連結工作專案和刪除連結的詳細資訊,請參閱 加入工作專案的連結For details on linking work items and deleting links, see Add link to work items.

注意

您可以使用的工作專案表單和功能,取決於您是從 web 入口網站開啟表單或 Visual Studio 的 Team Explorer 而定。Work item forms and features available to you can differ depending on whether you open the form from the web portal or Visual Studio Team Explorer.

連結至工作專案的工作專案Work items linked to 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. 樹狀拓撲連結支援巢狀階層、樹狀查詢,以及數種報表。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
  • 當您想要追蹤必須先完成才能啟動其他工作的工作時,請使用 前置任務-後續專案的 連結類型。當您使用 Project 規劃工作時,最常使用此連結類型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 projects or managed by different teams.

如需有關選擇連結類型的其他指引,請參閱相關附注一節中的 連結類型參考For additional guidance on choosing link types, review the Link type reference in the related notes section.

您可以從工作專案表單中建立連結、從查詢結果清單中顯示的工作專案、Microsoft Excel 或 Microsoft Project 中建立連結。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. 您也可以使用 Team Foundation 的任何用戶端程式,例如 Team Explorer 和入口網站,來建立連結或附加檔案。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.

此外,您也可以使用入口網站中的內容功能表或 Team Explorer。Also, you can use the context menu in the web portal or Team Explorer.

注意

針對每個工作專案,您最多可以新增1000個連結至其他工作專案。For each work item, you can add a maximum of 1000 links to other work items.

跨組織工作專案連結Cross-organization work item linking

使用 Azure Active Directory 的組織可以將存在於不同專案的工作專案連結在不同的組織中。Organizations that use Azure Active Directory can link work items that exist in different projects across organizations. 使用下列連結類型,如下所示:Use the following link types as indicated:

  • 當您想要追蹤不同組織中所定義且由不同小組管理之工作專案的相依性時,請使用 [取用 來源/產生 ] 連結類型。Use the Consumes From/Produces For link types when you want to track dependencies of work items that are defined in different organizations and managed by different teams.
  • 當要連結的工作專案定義在不同的組織中,並由不同的小組管理,但沒有強式相互相關性時,請使用 遠端相關 連結類型。Use the Remote Related link type when the work items being linked are defined in different organizations and managed by different teams, but don't have strong inter-dependencies.

顯示兩個外部連結的使用者案例表單 [連結] 索引標籤User Story form, Link tab, showing two external links

您可以在工作項目表單內使用其中一個連結控制索引標籤,建立工作項目之間的連結。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.

注意

您在入口網站中看到的影像可能會與您在本文中看到的映射不同。The images you see from your web portal may differ from the images you see in this article. 這些差異是因為對 Azure DevOps Services 所做的更新。These differences result from updates made to Azure DevOps Services. 不過,除非明確提及,否則您可以使用的基本功能保持不變。However, the basic functionality available to you remains the same unless explicitly mentioned.

注意

您在入口網站中看到的影像可能會與您在本文中看到的映射不同。The images you see from your web portal may differ from the images you see in this article. 這些差異是因為對內部部署 Azure DevOps 所做的更新。These differences result from updates made to your on-premises Azure DevOps. 不過,除非明確提及,否則您可以使用的基本功能保持不變。However, the basic functionality available to you remains the same unless explicitly mentioned.

在新的工作專案表單中,您可以使用 [ 相關工作 ] 區段或 [ 連結 ] 索引標籤來加入連結。From the new work item form, you can add a link using the Related Work section or from the Links tab.

開啟工作專案,並選擇 加號圖示以新增連結。

入口網站、工作專案表單、相關工作區段

選擇 [ 現有專案 ],以使用任何支援的連結類型連結至工作專案或其他物件。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: choose the linked item
  • 刪除連結:將其反白顯示,然後選擇 [ 刪除] 圖示

從查詢結果頁面,您也可以執行下列動作: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.

新的 web 表單僅可從 TFS 2017 和更新版本使用。The new web form is only available from TFS 2017 and later versions.

這些功能讓您能快速地連結或變更使用父子式連結類型的連結:These features let you quickly link or change links that use the parent-child link type:

您也可以使用 Excel 或 Project 來變更連結結構。You can also use Excel or Project to change the link structure. 請參閱使用 Excel 大量加入或修改工作專案 ,以及 使用 Project 建立您的待處理專案和工作。See Bulk add or modify work items with Excel and Create your backlog and tasks using Project.

測試相關的連結類型會將測試案例管理工作專案連結至另一個工作專案,或連結至其他工作專案。Test related link types link test case management work items to one another, or to other work items. 您可以從入口網站或 Microsoft Test Manager,查看針對測試套件定義的測試案例,以及為測試計劃定義的測試套件。From the web portal or Microsoft 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.

您可以使用 [已測試]/[測試 ] 連結類型,將工作專案連結至測試案例。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. 測試管理成品之間的大部分連結都會透過從 測試 頁面或 Microsoft Test Manager 執行工作來進行。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.

(TFS 2015) 的測試案例工作專案表單Test case work item form (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.

連結到程式碼成品和組建和發行管線的工作專案Work items linked to code artifacts and build and release pipelines

開發軟體時,您可以捕捉哪些程式碼變更和組建支援工作專案的完成。As you develop your software, you can capture which code changes and builds support the completion of a work item. 如此一來,您的小組就可以瞭解已完成的工作,或如何透過程式碼基底的變更審核記錄來修正 bug。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, Versioned Item, and Integrated in release environment.

成品與成品的連結類型

如下圖所示,用來建立連結的連結類型如下 — 圖 — 所示:分支、組建、變更集、認可、提取要求和已建立版本的專案。The link types used to construct these links—as illustrated in the following image—are: Branch, Build, Changeset, Commit, Pull Request, and Versioned Item.

成品與成品的連結類型

若要深入瞭解連結控制項或自訂開發連結控制項,請參閱 LinksControlOptions 元素、開發連結控制項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. 不過,更簡單的方法是在建立這些專案時,將工作專案 ID 加入至認可、提取要求、變更集或其他支援的 Git 或 TFVC 作業。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.

如需詳細資訊,請參閱下列文章:See the following articles for additional information:

連結至 Git 程式碼開發的工作專案Work items linked to Git code development

建議的方法是在建立分支、認可 (git) 、變更集 (TFVC) 、提取要求 (git) 中,從工作專案驅動開發或加入工作專案識別碼。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 可讓您使用認可連結類型,將工作專案連結至 認可Git lets you link work items to commits by using the Commit link type. 您可以透過數種方式來執行此動作:You can do this in several ways:

  • 在 Visual Studio Team Explorer 中,在認可變更之前加入工作專案識別碼In Visual Studio Team Explorer, add work item IDs before you commit your changes
    在認可變更之前,加入工作專案 ID 或拖曳專案

  • 您可以使用 git 認可 命令,並在批註中包含工作專案識別碼。You can use the git-commit command and include the work item ID in your comment. 例如,您將此註解 #35 攔截 null 例外狀況套用至認可。For example, you apply this comment #35 Catch null exception to your commit. 當您推送認可時,系統會在認可和工作專案 #35 之間建立認可連結。When you push the commit, the system creates a Commit link between the commit and work item #35.

  • 此外,使用新的工作專案表單 (可從 Azure Boards 和 TFS 2017) 取得,您可以 從工作專案驅動 git 開發 ,如下圖所示。And, with the new work item form (available from Azure Boards and TFS 2017), you can drive your git development from the work item as shown in the following image.

    工作專案表單,開發區段

連結至 GitHub 構件的工作專案Work items linked to GitHub artifacts

藉由連接 Azure Boards 與 GitHub 存放庫,您可以啟用 GitHub 認可和提取要求之間的連結至工作專案。By connecting Azure Boards with GitHub repositories, you enable linking between GitHub commits and pull requests to work items. 使用 Azure Boards 來規劃和追蹤您的工作時,您可以使用 GitHub 進行軟體發展。You can use GitHub for software development while using Azure Boards to plan and track your work.

支援的連結類型包括 Github 認可Github 問題github 提取要求The link types supported include GitHub Commit, GitHub Issue, and GitHub Pull Request.

支援的連結類型包括 Github 認可github 提取要求The link types supported include GitHub Commit and GitHub Pull Request.

重要

您只能連結到已連線至 Azure Boards 的儲存機制的 GitHub 成品。You can only link to GitHub artifacts whose repositories you have connected to Azure Boards. 若要建立該連接,請參閱 將 Azure Boards 連接到 GitHubTo create that connection, see Connect Azure Boards to GitHub. 若要深入瞭解連結至 GitHub 成品的詳細資訊,請參閱將 github 認可、提取要求和問題連結至工作專案To learn more about linking to GitHub artifacts, see Link GitHub commits, pull requests, and issues to work items.

連結至 TFVC 程式碼開發的工作專案Work items linked to TFVC code development

Team Foundation 版本控制 (TFVC) 可讓您使用 變更集 和已建立版本的 專案 連結類型,將工作專案連結至版本控制變更集或已建立版本的原始程式碼檔案。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.

Team Explorer,我的工作,暫止的變更,簽入

連結至網站、網路共用、分鏡腳本或檔的工作專案Work items linked 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.

使用 [超連結] 或 [分鏡腳本] 連結類型,將工作專案連結至 URL。

從 [ 鏡腳本] 索引標籤,您可以連結使用 PowerPoint 分鏡腳本或其他應用程式建立的分鏡腳本。From the Storyboards tab, you can link storyboards that you created using PowerPoint Storyboarding or other application. [分鏡腳本] 索引標籤和 [連結] 控制項可從 TFS 2015 的 web 和用戶端工作專案表單中取得。The Storyboards tab and links control is available from the web and client work item form for TFS 2015.

針對與 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. 您也可以使用這種連結類型,從 Power Point 檔案連結至工作專案,如 使用 PowerPoint的腳本構想中所述。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.

連結至架構圖表的工作專案Work items linked to architectural diagrams

當您想要將工作專案連結至使用 Visual Studio Enterprise 所建立的架構圖表時,請選擇 模型 連結類型。You choose the Model link type when you want to link a work item to an architectural diagram created using Visual Studio Enterprise. 只有當您從 Visual Studio Enterprise 工作時,才能使用此連結類型。This link type is only available when you work from Visual Studio Enterprise. 您可以使用此連結類型來追蹤工作、測試案例、bug、需求、問題,或與模型特定部分相關聯的其他工作類型。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.

模型連結類型會將工作專案連結至圖表

若要將工作專案連結至圖表,請在 [Visual Studio 中開啟工作專案,選擇 [ 所有連結 ] 或 [ 其他連結 ] 索引標籤,然後選擇 [ 模型 ] 連結類型。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.

注意

您無法建立可顯示 Test Plans、測試套件和測試案例階層式觀點的查詢。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. 您只能透過 測試>Test Plans 頁面來查看階層。You can only view the hierarchy through the Test>Test Plans page.

您現在應該已廣泛瞭解您可以建立的各種連結關聯性來追蹤相依性,並建立程式碼開發的審核記錄。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.

當您形成連結關聯性之後,就無法從入口網站編輯該關聯性的連結類型,但您可以從 Team Explorer 中進行。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:

您可以從 Visual Studio Marketplace 的 [Azure DevOps] 索引標籤中,安裝可用的 工作專案視覺效果延伸 模組,以在工作專案表單中查看相關的工作專案和物件。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, Azure DevOps tab.