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

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
(System_Id=TargetWorkItemID and
System_WorkItemType <> 'User Story')
left join TestResultView
System_Id = TestCaseId
System_WorkItemType in
('User Story', 'Test Case', 'Bug')
RemovedDate = '9999-01-01
SourceWorkItemID in (@UserStory)

The User Story Quality report looks like: