Author: Ranjit Gupta & Raj Kamal
Background:
Background:
Visual Studio provides a nice reactivation
report, out of the box, to help you determine how effectively team is
fixing bugs. This report helps you answer questions such as “How many bugs have been reactivated in the
current iteration?” or “Is the team resolving and closing reactivated bugs and
stories at an acceptable rate?” but doesn’t go into details, if team wants
to get reactivation report at work item level to answer a follow up question,
such as, “How many times bugs have been reactivated and what are the bugs that
have been reactivated more than X number of times?” This kind of report can
help the teams in taking corrective action as it’s quite obvious that bug
reactivation is rework and wastage of effort, time and money.
Solution:
There is also a related thread on
MSDN Discussion on a similar topic.
If you came to this blog, finding solution of this very problem then the good
news is that now there is add-in that we have published on the Visual Studio
Gallery, which you can download and use to get this kind
of a report in excel (CSV) format for further analysis.
In additional to that, this blog
post will also go and explain the logic that is used to generate this report so
you can go and customize it for your specific needs if you like it.
Details of the solution (Walkthrough)
Our add-in uses TFS
Client Object Model to retrieve this information. The solution to the
problem can be broken down in the following simple steps
1.
Retrieve bug id of all the bugs and store them in a work item collection.
You need to provide TFS “TeamProject”
name as user parameter. You can also specify the iteration path if you are
specifically interested to get this report for a given iteration.
string wiqAllBugs = "SELECT
[System.Id] FROM WorkItems WHERE
[System.TeamProject] = '{0}'
AND [System.WorkItemType] = 'Bug'
AND [System.IterationPath] UNDER'" +
iteration + "'";
string tfsQuery = string.Format(wiqAllBugs, projName); WorkItemCollection wiBugCollection
= store.Query(tfsQuery);
2.
For each bug iterate through the revision
history and look for the text Edited
(Active to Resolved") and Edited (Resolved to Active") or Edited (Closed to Active")
The logic is to look for the bugs
that are changed from Resolved state to Active state or from Closed state to Active
state and count the no. of instances this has happened for a bug as bug
reactivation count metric. We are also capturing transition from Active to
Resolved state to capture information like “resolved by”, “resolved state” etc.
that will help in further investigation
foreach (Revision revision in wItem.Revisions)
{
if
(revision.GetTagLine().Contains("Edited
(Active to Resolved"))
{
//retrieve all the
information required like resolved date,resolved by etc..
}
else if (revision.GetTagLine().Contains("Edited (Resolved to Active") ||
revision.GetTagLine().Contains("Edited
(Closed to Active"))
{
// increase your counter every time to
get the total reactivation count
}
}
3.
Finally check if your bug reactivation counter
is greater than X (or 0 to find bug that are reactivated at least once) and
print them to console/.csv / html
4.
Our add-in, generates a CSV report with this
information (find below the sample)
You can go and tweak this logic as
per your needs. We hope you would have find this quick workaround useful.
No comments:
Post a Comment