bug統計分析續(一)基於SQL的Bug統計方法
本文由 @lonelyrains 出品。轉載請註明出處。
文章鏈接: http://blog.csdn.net/lonelyrains/article/details/44225533
本篇重點討論基於sql的bug統計分析方法。
1、與時間和狀態的關系:
1)考察每一個時間單位(年、月、日)產生的bug量
2)考察每一個時間單位(年、月、日)解決的bug量
3)考察每一個時間單位(年、月、日)遺留的bug量
4)考察每一個bug遺留的時間單位(年、月、日)
5)考察平均bug遺留的時間單位(年、月、日)
6)通過結合1)、2)、3)考察分析發現、解決bug的時間段(月、日、時)峰值
當中6能夠用來指導測試、開發效率
2、與時間、角色的關系:
1)考察每一個測試每一個月發現的bug量
2)考察每一個開發每一個月解決的bug量
3)考察每一個測試自開發提交版本號測試之後,發現每一個新bug的時延
4)考察每一個開發自測試提交bug之後。解決每一個新bug的時延
此1234均能夠用來指導績效考核
3、其它能夠考慮與bug發生關系的系數:
1)基於項目劃分
2)基於模塊(硬件、固件、底層軟件、上層應用(前端、後臺)等,依據不同項目能夠不同的劃分情況)
3)基於功能性質劃分(非致命、一般、界面、崩潰等)
4)基於重現概率劃分
等等
3、高級擴展
1)推斷一個bug是否是難bug,並把它找出來:依據解決時延、反復reopen的次數、測試和開發者的標註
2)定義每一個項目子模塊解決本項目子模塊bug最多的人為項目子模塊負責人。查詢每一個人所負責的項目子模塊數等
4、案例:
使用bugfree。會發現一個問題,全部的bug信息都放在一張表bf_buginfo裏。
ModulePath字段在項目有多個子模塊時,是作為整字段中間加‘/‘區分層級的。
以下是我用到的一些SQL統計語句(為當中一個考察點,筆者在下一篇博客裏專門抽象出一個SQL面試題):
#--查詢bug整體情況 #select ProjectName,ModulePath,BugTitle,BugStatus,OpenedDate from bf_buginfo order by ProjectName,ModulePath,OpenedDate; #--查詢每一個項目的bug數目(XXXX算一個項目) #select count(*),ProjectName from bf_buginfo group by ProjectName having count(*) >= 1; #--查詢XXXX項目每一個模塊的bug數目 #select count(*),ModulePath from bf_buginfo where ProjectName like ‘XXXX‘ group by ModulePath having count(*) >= 1; #select * from bf_buginfo where ProjectName like ‘XXXX‘ and ModulePath = ‘/‘; #select BugId,ProjectName,ModulePath,BugTitle,BugStatus,OpenedDate from bf_buginfo order by OpenedDate,ResolvedDate,ClosedDate group by DATE_FORMAT(OpenedDate,‘%Y%m‘); #--查詢每一個月產生的bug數目 #select count(*),DATE_FORMAT(OpenedDate,‘%Y-%m‘) from bf_buginfo group by DATE_FORMAT(OpenedDate,‘%Y%m‘); #--查詢XXXX每一個月產生的bug數目 #select count(*),DATE_FORMAT(OpenedDate,‘%Y-%m‘) from bf_buginfo where ProjectName like ‘XXXX‘ group by DATE_FORMAT(OpenedDate,‘%Y%m‘); #--查詢XXXXbug高峰期的具體內容 #select ModulePath,BugTitle,BugStatus,OpenedDate,DATE_FORMAT(OpenedDate,‘%Y-%m‘) from bf_buginfo where ProjectName like ‘XXXX‘ and ( DATE_FORMAT(OpenedDate,‘%Y%m‘) = ‘201310‘ or DATE_FORMAT(OpenedDate,‘%Y%m‘) = ‘201406‘ ); #--查詢XXXXbug狀態情況 #select count(*),BugStatus from bf_buginfo where ProjectName like ‘XXXX‘ group by BugStatus #--查詢全項目bug狀態情況 #select count(*),BugStatus from bf_buginfo group by BugStatus #--查詢重難點bug:0基礎過濾方法:從已解決的bug中分析:reopen的 : 須要了解怎樣獲取reopen的記錄 :bf_testaction和bf_buginfo #select count(distinct(bugId)) from Bf_testaction as taction , bf_buginfo as buginfo where ActionType = ‘Activated‘ and taction.idvalue = buginfo.bugid #select count(distinct(bugId)) from bf_testaction as taction , bf_buginfo as buginfo where ActionType = ‘Activated‘ and taction.idvalue = buginfo.bugid and ProjectName like ‘XXXX‘ #activated 226 #activated 138 #--查詢重難點bug:0基礎過濾方法:從已解決的bug中分析:長時間未解決 #690/1695/2715 datediff>=2-fixed/closed/all #select count(*),BugID,ResolvedDate,ProjectName,ModulePath,BugTitle,datediff(ResolvedDate,OpenedDate) from bf_buginfo where bugstatus = ‘closed‘ and datediff(ResolvedDate,OpenedDate) >= 2 and Resolution = ‘Fixed‘ order by ModulePath DESC,BugID DESC #378/927/1248 datediff>=2-fixed/closed/all #ResolvedDate用於對照svn記錄。方便查看 #select BugID,ResolvedDate,ProjectName,ModulePath,BugTitle,datediff(ResolvedDate,OpenedDate) from bf_buginfo where ProjectName like ‘XXXX‘ and bugstatus = ‘closed‘ and datediff(ResolvedDate,OpenedDate) >= 2 and Resolution = ‘Fixed‘ order by ModulePath DESC,BugID DESC #--依據解決人查詢bug #select count(*),ResolvedBy from bf_buginfo where Resolution = ‘fixed‘ and BugStatus = ‘closed‘ group by ResolvedBy order by count(*) #--定義每一個項目子模塊解決本項目子模塊bug最多的人為項目子模塊負責人,查詢每一個人所負責的項目子模塊數 select count(*),ResolvedBy from ( select B.* from (select ModulePath, ResolvedBy, count(*) as num from bf_buginfo where Resolution = ‘fixed‘ and BugStatus = ‘closed‘ group by ModulePath, ResolvedBy) B , (select A.ModulePath, MAX(A.num) as num from ( select ModulePath,ResolvedBy,count(*) as num from bf_buginfo where Resolution = ‘fixed‘ and BugStatus = ‘closed‘ group by ModulePath, ResolvedBy ) A group by A.ModulePath ) C where B.ModulePath = C.ModulePath and B.num = C.num order by B.ResolvedBy ) D group by ResolvedBy
bug統計分析續(一)基於SQL的Bug統計方法