locked
TFS Query to Get Bugs details along with User Story info RRS feed

  • Question

  • HI Team

    We are using below queries

    Quer1: To get Bugs details for given iteration and WorkItemType =Bug and Priority P1
     query = new Query(_store,
                              string.Format(
                                  "SELECT[System.Id], [System.State], [System.NodeName],
             [Microsoft.VSTS.Common.Priority],[Microsoft.VSTS.Common.Severity], [System.Reason],
             [System.AreaPath], [System.IterationPath] FROM WorkItems WHERE[System.IterationPath] =
             '"  + iterationPath + "' AND [Work Item Type] = 'Bug' AND [Microsoft.VSTS.Common.Priority] = 'P1');
                        }

    Query2: To get TargetId(which is UserStory Id) for given WorkItem ID
    new Query(_store, String.Format("SELECT [Target].[System.Id] FROM WorkItemLinks WHERE ([Source].[System.Id] = {0})
    and ([Source].[System.WorkItemType] = '"+ workItemType + "') 
    And ([Target].[System.WorkItemType] IN GROUP 'Requirement Category')
    mode(MustContain)", testcaseid));
        
    Query3: To get Requirement/UserStory name for given UserStory Id
    select [System.State] from WorkItems where ([System.ID] = 4094) and ([System.WorkItemType] in group 'Requirement Category')

    We are using above queries to get Bug details along with Requirements/UserStories.
    In our project, there are some bugs which are not linked to UserStories, but these bugs are linked to TestCases which has UserStories.

    Is there any Query using which i can get
    Bugs details along with UserStories, If at all the bug does not have Userstory linked then i need get Userstories from the TestCase which are linked to Bugs.

    Really appreciate if you can help in this regard.

    Friday, November 24, 2017 5:27 AM

Answers

  • Hi,

    No, you need to check whether the linked Test case is linked to a User story.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, November 25, 2017 6:09 AM
    Moderator