* [task#128659,0.5h] add unit test.

This commit is contained in:
qixinzhi
2024-09-19 16:55:34 +08:00
committed by 宋辰轩
parent 6333062e2b
commit bbebb4fc55
2 changed files with 22 additions and 14 deletions
+13 -7
View File
@@ -7,20 +7,26 @@ title=deduplication
timeout=0
cid=1
- 测试去重后count_of_bug的数据条数 @2
- 测试去重后count_of_case_in_product的数据条数 @2
- 测试去重后count_of_bug的数据条数 @9
- 测试去重后count_of_annual_created_project的数据条数 @5
- 测试去重后count_of_release_in_product的数据条数 @10
- 测试去重后count_of_monthly_finished_story_in_product的数据条数 @8
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/calc.unittest.class.php';
su('admin');
zenData('metriclib')->loadYaml('metriclib_deduplication', true)->gen(160);
zenData('metriclib')->loadYaml('metriclib_deduplication', true)->gen(40, true, false);
$metric = new metricTest();
$codeList = array();
$codeList[] = 'count_of_bug';
$codeList[] = 'count_of_case_in_product';
$codeList[0] = 'count_of_bug';
$codeList[1] = 'count_of_annual_created_project';
$codeList[2] = 'count_of_release_in_product';
$codeList[3] = 'count_of_monthly_finished_story_in_product';
r($metric->deduplication($codeList[0])) && p('') && e('2'); // 测试去重后count_of_bug的数据条数
r($metric->deduplication($codeList[1])) && p('') && e('2'); // 测试去重后count_of_case_in_product的数据条数
r($metric->deduplication($codeList[0])) && p('') && e('9'); // 测试去重后count_of_bug的数据条数
r($metric->deduplication($codeList[1])) && p('') && e('5'); // 测试去重后count_of_annual_created_project的数据条数
r($metric->deduplication($codeList[2])) && p('') && e('10'); // 测试去重后count_of_release_in_product的数据条数
r($metric->deduplication($codeList[3])) && p('') && e('8'); // 测试去重后count_of_monthly_finished_story_in_product的数据条数
@@ -4,27 +4,29 @@ author: zhouxin
version: "1.0"
fields:
- field: id
range: 1-160
range: 1-40
- field: metricID
range: 107{10},188{10}
- field: metricCode
range: count_of_bug{10},count_of_case_in_product{10}
range: count_of_bug{10},count_of_annual_created_project{10},count_of_release_in_product{10},count_of_monthly_finished_story_in_product{10}
- field: system
range: 1{20},0{20}
- field: product
range: "[]{20},1{10},2{10}"
range: "[]{20},1,3,5,7,9,1,3,5,7,9,1,3,5,7,9,1,3,5,7,9"
- field: year
range: "[]{10},2021{10}[]{10},2021{10}"
range: "[]{10},2012-2016{2},[]{10},2021{10}"
- field: month
range: "[]{20},11{10},[]{10}"
range: "[]{30},01,02,03,04,05,01,02,06,07,08"
- field: week
range: "[]{20},44{5},45{5},[]{10}"
range: "[]{40}"
- field: day
range: "[]{40}"
- field: value
range: 1
- field: date
range: "20220101 000000-20230101 000000:10D{2}"
range: "20220101 000000-20220110 000000:1D,20220109 060000-20220109 060001:1,20220101 000000-20220101 000005:1,20220102 000000-20220102 000005:1,20220103 000000-20220103 000005:1,20220104 000000-20220104 000005:1,20220104 000000-20220104 000010:10"
type: timestamp
format: YYYY-MM-DD hh:mm:ss
- field: deleted
range: "0"
...