* Finish task#98454.

This commit is contained in:
qixinzhi
2023-07-26 02:43:16 +00:00
parent 2a6bfef912
commit a2b1f09576
2 changed files with 38 additions and 10 deletions
@@ -10,10 +10,10 @@
* 单位:个
* 描述:按全局统计的有效Bug数是指系统或项目中真正具有影响和价值的Bug数量。有效Bug通常是指导致系统不正常运行或影响用户体验的Bug。统计有效Bug数可以帮助评估系统或项目的稳定性和质量也可以评估测试人员之前的协作或对产品的了解程度。
* 定义:所有Bug个数求和
解决方案为已解决和延期处理
或状态为激活的Bug数
过滤已删除的Bug
过滤已删除的产品
* 解决方案为已解决和延期处理
* 或状态为激活的Bug数
* 过滤已删除的Bug
* 过滤已删除的产品
* 度量库:
* 收集方式:realtime
*
@@ -26,16 +26,15 @@
*/
class count_of_valid_bug extends baseCalc
{
public $dataset = null;
public $dataset = 'getBugs';
public $fieldList = array();
public $fieldList = array('t1.status', 't1.resolution');
//public funtion getStatement($dao)
//{
//}
public $result = 0;
public function calculate($row)
{
if($row->status != 'active' or $row->resolution == 'fixed' or $row->resolution == 'postponed') $this->result += 1;
}
public function getResult($options = array())
@@ -43,4 +42,4 @@ class count_of_valid_bug extends baseCalc
$records = $this->getRecords(array('value'));
return $this->filterByOptions($records, $options);
}
}
}
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('product')->config('product', $useCommon = true, $levels = 4)->gen(10);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=count_of_valid_bug
cid=1
pid=1
*/
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(356, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('72'); // 测试356条数据Bug数。
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(652, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('126'); // 测试652条数据Bug数。
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(1265, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('247'); // 测试1265条数据Bug数。