2013-01-10 20 views
1

我需要查找TFS項目中所有在最近2周內嚴重性更改爲高的錯誤。 我只能發現,在過去的2周高嚴重性與下面的查詢打開的錯誤:查找TFS上嚴重性更改的錯誤

<?xml version="1.0" encoding="utf-8"?> 
<WorkItemQuery Version="1"> 
    <TeamFoundationServer>http://tfs-srv:8080/tfs/defaultcollection</TeamFoundationServer> 
    <TeamProject>Project</TeamProject> 
    <Wiql>SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo],[System.State] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] = 'Bug' AND [Microsoft.VSTS.Common.Severity] = 'High' AND [System.CreatedDate] &gt; @today - 14 ORDER BY [System.Id] </Wiql> 
</WorkItemQuery> 

回答

0

簡單地去工作項類型........>我的查詢,然後使一個新的查詢。 它是一個簡單的用戶界面,使您的查詢容易。您可以通過以下 例如找到它:

團隊項目=項目

工作itemn類型=錯誤

嚴重性=高

2

我不認爲這可以通過簡單的定義來完成通過VS查詢,因爲它涉及比較兩個工作項目歷史記錄。

另一方面,可以直接查詢TFS數據庫來獲取數據。嘗試在TFS服務器上的TFSWarehouse數據庫上運行此查詢:

SELECT DATEDIFF(DD, H.System_ChangedDate, GETDATE()) as DaysAgo, H.System_Id, H.System_ChangedDate 
, H.System_Rev, H2.System_Rev, H.Microsoft_VSTS_Common_Severity, H2.Microsoft_VSTS_Common_Severity 
, 'X', H.* 
FROM WorkItemHistoryView H INNER JOIN WorkItemHistoryView H2 ON H.System_Id = H2.System_Id 
                   AND H.System_Rev = H2.System_Rev + 1 
                   AND H.Microsoft_VSTS_Common_Severity = 'High' 
                   AND H2.Microsoft_VSTS_Common_Severity = 'Low' 
                   AND H.System_ChangedDate BETWEEN DATEADD(dd, -14, GETDATE()) AND GETDATE() 
                   AND H2.RecordCount = 1 
WHERE H.ProjectNodeName = 'MyProject' 
AND H.System_WorkItemType = 'Bug' 
AND H.RecordCount = 1 
ORDER BY H.System_Id ASC