Teams working on Agile Methodology create User Stories to
define new requirements. The question that is asked various times is “How to measure the
Quality of a User Story?”

There are two important aspects to measure the quality of a
User Story:

  • Test Cases – It’s important to identify the Test Cases which
    will test the functionality defined in the User Story. The Test Cases can be Automated
    or Manual. To measure the quality of a User Story, it’s important to know how
    many tests Passed or Failed.
  •  Bugs – It’s important
    to track the bugs which were found while testing the User Story. To measure the
    quality of a User Story, it’s important to know how many Bugs are in Active or
    Resolved state and need to be fixed or verified.

The User Story Quality can be reported by creating a SSRS report
which lists the Test Cases and Bugs associated to a User Story with their
current status.  To know about creating
an SSRS report for TFS reporting, see http://social.technet.microsoft.com/wiki/contents/articles/how-to-create-reports-for-tfs-2010-test-results.aspx

The query which needs to be used is:

select distinct SourceWorkItemID as
'UserStoryID', (select System_Title from
CurrentWorkItemView where System_Id= SourceWorkItemID)  as 'UserStoryTitle',
System_WorkItemType as 'AssociatedItem', System_Id as 'ID', System_Title as 'Title', System_State as 'State',
Microsoft_VSTS_TCM_AutomationStatus as 'AutomationStatus', (select top 1
ResultOutcome from TestResultView where TestCaseId=System_Id
order by
ResultDate desc)
as 'ResultOutcome'  from
FactWorkItemLinkHistory

join
CurrentWorkItemView

on

(System_Id=TargetWorkItemID and
System_WorkItemType <> 'User Story')

left join TestResultView

on

System_Id = TestCaseId

where
System_WorkItemType in
('User Story', 'Test Case', 'Bug')

and
RemovedDate = '9999-01-01
00:00:00.000'

and
SourceWorkItemID in (@UserStory)

The User Story Quality report looks like: