2

How can I get a list of linked work item IDs for a set of work items?

  • Excel-hosted queries preferred. API Sample is acceptable.
  • Direct DB table query is acceptable (read-only and unsupported of course!)

Many thanks in advance! -Zephan

MORE INFORMATION

UPDATE: No answers for my original Q so broadening scope of acceptable answers as follows:

  1. Answer for TFS2015 (migrating very shortly) or TFS2013 (potentially useful for TFS2015) is preferred over TFS2010

  2. Coding acceptable if there are any APIs or PowerShell cmdlets (MS or community).

  3. Connecting directly (read-only!) to TFS DB tables is acceptable (source tables and related relationship link table names). Yes, directly referencing TFS DB tables is VERY unsupported, read-only, and "AT YOUR OWN RISK." Still beats having to manually copy/paste data or reconstruct list of links in Excel.

ORIGINAL QUESTION & DETAILS

My team uses TFS2010 (soon 2013 or hoping 2015) and VS2010-2015. I need to support traceability reports and analyze/quantify our coverage of ~300 Test Case work items linked to ~400 Requirement work items. Direct Link and Tree queries are close but don't give me related links on the same row as parent work item. Many thanks in advance for your suggestions and any related code fragments.

Example:

3 test cases (Test1, Test2, Test3)
4 Requirements (Req1, Req2, Req3, Req4)

  • For simplicity let's just use TFS work item IDs to represent each TestN and ReqN. In actuality, I have a keyword to identify my validation requirements (separate from the 1,000's of other requirements in this Team Project). The only Test Case WI I care about for this problem are those linked to one or more Validation Requirement trace-ability.

Scenarios:

  1. 1:1 (simple) Test1 is linked to Req1
  2. 1:2 (1:n) Test2 is linked to Req2 and Req3
  3. 2:1 (n:1) Test3 (and Test2) are both linked to Req3
  4. 0:1 (Requirement missing Test coverage) Req4 has no test case links
    • I have a good coverage gap query by creating a Direct Link query for all Requirements then set "linking filters" to Only return items that do not have the specified links.

Desired output (all tests with list of related work items):

|Test1 | Req1       |
|Test2 | Req2, Req3 |
|Test3 | Req3       |

For row #2 I am OK with other separators or even entire list using same separator (.CSV or TAB delimited). Skip right to answer now if you have a tidy answer. If not then I added considerable RELATED RESEARCH info below to help kick-start an idea that fits the need! Especially since this hasn't been discoverably solved in the last 5 years :-).

RELATED RESEARCH (loooong but may be useful)

1. Visual Studio Queries

  • Flat Queries should support a list of linked items out-of-the-box... but it does not. RelatedLinkCount field is handy for knowing if there are any links to chase, but that's it for flat queries. 

  • Direct Link queries give a list of all direct links, but the related IDs are on rows below the parent work item. I am seriously considering creating a formula to look on the next X rows to build a list of IDs, but this would be fragile especially when over 3 requirements are linked to same test. Still might solve 80% of my tracing needs.

  • Tree Queries also show links, but on different rows. Additionally they tend to follow just one link type. Ideally I will need list of User Requirements linked to Functional Requirements linked to Test Case(s).

2. Tools / Plug-ins

  • SmartExcel4TFS (eDEVTech, http://www.modernrequirements.com/smartexcel4tfs/) has 3 reports it supports, but none get me the core data I need in easily used format. At least it is FREE if you have an MSDN Premium subscription.
    • Requirements to Tests Trace Matrix is super-interesting. Alass, right now I need to go the other way (Requirements linked to a given test case). Also it merges cells and has sub-sections that are hard to manipulate I think. (I may revisit this option though.)
    • Intersection Traceability Matrix report is WAY too wide for a full 300 x 400 grid :-O.
    • Work Item Decomposition Matrix also didn't give me desired contents. (though frankly I've forgotten this report layout from when I checked ~1 month ago.)

3. TFS API calls

I have actually avoided this route in favor of native Excel solution... but if I can get an example of Excel VBA code (or other code with link to calling within Excel) I may go this route. At this point I don't have time to dig into rolling my own... but this would be cool assuming performance is acceptable.

Relevant API/code fragments:

OK, that's everything I have gathered on this problem. Please help contribute with the missing magic tool/snippet or follow the info above to build that last bit I have not had time to prototype & debug. Many thanks in advance!! -Zephan

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Zephan Schroeder
  • 695
  • 6
  • 12

0 Answers0