TFS 2013 Queries through multiple work item hierarchies - tfs

RE: TFS/MTM: Plan>Contents>Create query-based suites...
I am trying to get all the test cases returned under each feature for targeted testing. But, the features aren't directly linked to the test cases. The features are linked directly to user stories which are directly linked to Test Cases.
So, How do I get a list of test cases by Feature when running query-based?

No, we cannot achieve that, multiple work item hierarchies (more than 2 hierarchies) is not supported for work item query.
We can only query 2 hierarchies (Parent/Child), just using the type of query Work items and direct links or Tree of work items to do that.
So, in your scenario you need to query the test cases by user stories, then filter the stories by Feature.

Related

Get User Stories with more than 5 Bugs in TFS

I want to select user stories with more than 5 bugs as children.
Using below query I can get user stories with at least one bug but filtering out the ones with less than 5 I'm lost.
How can I do this? Or is there any other way I can get this output? i.e: TFS extension
There is no build-in feature to count/filter linked work item's count of a specific work item type.
As a workaround, you could export tfs query results to Excel and manage the results in excel side. With the help of excel, you should be able to filter out those work items you needs.
Another way is using TFS API to get the work items and their linked work items with bug type, finally count the number of linked work items. About how to use API, please take a look at this related question: Retrieving work items and their linked work items in a single query using the TFS APIs
You can use in the query in "Related Link Count" field:

TFS Work Items: Workaround for dashboard widgets unable to show tree of work item type queries

We have a work item structure in TFS 2015 (Will soon be upgraded to 2017, in case there are features there which may be relevant) which consists of the usual CMMI template hierarchy: Epic->Feature->Requirement (Where requirement is roughly analogous to PBI in other templates, for those unfamiliar)
We have abstracted the large body of work by making Epic and Feature meaningful. Applying a common analogy, an Epic->Feature->Requirement in this setup for a requirement on a webpage might be [Security]->[Password Management]->[Password Complexity rule xyz]
The main problem is that, while the 'tree of work items' type query is powerful and useful for this setup, some features of TFS only work on flat list of work item type queries, including dashboard widgets. Continuing the example above, if I wanted to create a widget to see how many Security Requirements (PBIs) were completed, I could not do that.
I'm looking for ideas on how to get around this restriction in VS2015 or VS2017, and the best solution I can think of so far is to create a service hook which uses the TFS api to traverse the tree and then copy the title or ID of the parent Epic/Feature onto the Requirement in some dummy field. This seems very clunky and inelegant. Another option would be to mirror the Epic/Feature hierarchy in Areas, but this is quite unfavorable as we use the Area for another purpose and it creates a maintenance problem as they would need to be kept in sync.
There is Query Results and Chart for Work Items widgets that can uses Tree of work items in TFS 2015, but can’t just count the children work items (e.g. Requirements)
You can build a custom widget extension and retrieve the corresponding work items through REST API and count related work items.
There is a sample with detail code of how to retrieve the data through REST API, so you can refer to this article to build a custom widget extension: Add a dashboard widget

MTM Direct Links Query vs Query-based suit (direct-links)

Direct Links query can be created two ways in MTM
Plan->Contents->New Query-based suite->(query type)->Work Items and Direct Links
Track->Queries->New Direct-Link Query
First one creates a test suite in the end. Is there any other difference?
Your two techniques are doing different things and have different purposes.
Option 2 is simply doing a Work Item Query, the same way you can do in Team Explorer/Visual Studio and also Team Web Access.
Once you have viewed the information you can discard it or save it in "My Queries" or "Shared Queries". If you save it, you can view the results in Excel for example or perhaps share it with colleagues.
Option 1 is all about creating a Test Suite which is a grouping of Test Cases.
There are static suites which are essentially folders for grouping Test Cases.
There are requirements based suites - for example, add all the PBIs from Sprint 1 and then we can add Test Cases to ensure we have tested against their acceptance criteria.
Then there are query based suites which will add all the test cases which match your specified query. New test cases will be added if they match the query (eg. all high priority test cases)
Organizing Test Cases Using Test Suites(2012)
So, if you want a test plan then use option 1. If you want to simply run queries, use option 2 (or use team explorer/web access to do the same thing)

TFS 2013 Queries for work item hierarchies with multiple levels

I have 3 entities (WorkItem Type) in TFS, This is the relationship between my entities:
[Release] 1------n [WorkOrder] n--------n [Bug]
I need to show Release and it's related WorkItems and related Bugs in one query (list).
I tried edit query and set it as WorkItems and Direct Links but it will show only one level of related Items.
I tried edit query and set it as Tree of workitems it works only for parent-child relations.
Any Idea?
Can you verify that the statement below is correct?
All WorkOrder items are children to a parent Release. Bugs are not directly linked to a Release, but are related to any number of WorkOrders.
Unfortunately it appears that you are correct. For the time being there isn't a way to directly create the exact query you want that will show multiple Releases, all of the children WorkOrders, and all of the related Bugs in a single multi-level tree view.
I can think of two workarounds for you:
Remove the Release from the results and instead add a query parameter that targets specific releases. Use the Work Items and Direct Links query option to query WorkOrders as the top-level work item and Related Bugs as the linked work items. This will provide the data you want in the expected format (Bugs would collapse under Work Items). If it's not for a report, your developers likely won't complain about having to key in a specific release. Why would they want to query work items across multiple releases as part of their work? If it is for a report, you could pull in multiple query results to Excel or another tool and format accordingly.
SQL Server Reporting Services should allow you to build filters for this, should you wish to build a report.
I think this answer your question:

TFS 2010: Queries based on the elements of other queries?

is it possible to create new queries in TFS 2010 based on the result of another query?
For example, one (parent) query selects all work items located under a certain work item (lets say work item with ID=5). And now I want to create other queries, that select all bugs, all tasks etc. from the results of the first query?
There, I only have to change the ID of the "parent" work item once and not in all subsequent queries.
Is this possible in TFS 2010 in combination with VST 2010?
Thanks
Konrad
There is a basic support for what you 're after in the GUI editor for WIQL: try with query of type "Tree of Work Items" - which creates a multi-level structure. There is minimal support to what you can handle in this context, for example it's not possible to pick work items with different criterias from level to level.
On the other hand you can implement a custom tool using the TFS-API. There you should be able to tailor to your needs exhaustively. I can support in such endeavor in case you 're interested.
What you want to do seems to be more of a report than a plain query. I think you should have a look at implementing custom reports.

Resources