bug统计分析续(一)基于SQL的Bug统计方法

本文由 @lonelyrains 出品。转载请注明出处。

 
文章链接: http://blog.csdn.net/lonelyrains/article/details/44225533


上一篇为 bug统计分析初步


本篇重点讨论基于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




原文地址:https://www.cnblogs.com/jhcelue/p/6881420.html