* Add unit test of report.
This commit is contained in:
@@ -0,0 +1,365 @@
|
||||
<?php
|
||||
class reportTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('report');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test compute percent of every item.
|
||||
*
|
||||
* @param array $datas
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function computePercentTest($datas)
|
||||
{
|
||||
$objects = $this->objectModel->computePercent($datas);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$percents = '';
|
||||
foreach($objects as $moduleID => $object) $percents .= "$moduleID:$object->percent;";
|
||||
return $percents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create json data of single charts.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createSingleJSONTest($executionID)
|
||||
{
|
||||
global $tester;
|
||||
$this->execution = $tester->loadModel('execution');
|
||||
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$sets = $this->execution->getBurnDataFlot($executionID, 'left');
|
||||
$dateList = $this->execution->getDateList($execution->begin, $execution->end, 'noweekend', 0, 'Y-m-d');
|
||||
|
||||
$objects = $this->objectModel->createSingleJSON($sets, $dateList[0]);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test convert date format.
|
||||
*
|
||||
* @param array $dateList
|
||||
* @param string $format
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function convertFormatTest($dateList, $format = 'Y-m-d')
|
||||
{
|
||||
$objects = $this->objectModel->convertFormat($dateList, $format = 'Y-m-d');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get executions.
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $end
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionsTest($begin = 0, $end = 0)
|
||||
{
|
||||
$begin = $begin != 0 ? date('Y-m-d', strtotime(date('Y-m-d') . $begin)) : 0;
|
||||
$end = $end != 0 ? date('Y-m-d', strtotime(date('Y-m-d') . $end)) : 0;
|
||||
$objects = $this->objectModel->getExecutions($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$executions = '';
|
||||
foreach($objects as $executionID => $execution) $executions .= "$executionID:$execution->estimate,$execution->consumed,$execution->projectName;";
|
||||
return $executions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get products.
|
||||
*
|
||||
* @param string $conditions
|
||||
* @param string $storyType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductsTest($conditions, $storyType = 'story')
|
||||
{
|
||||
$objects = $this->objectModel->getProducts($conditions, $storyType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$planCount = 0;
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if(isset($object->plans)) $planCount += count($object->plans);
|
||||
}
|
||||
return 'product:' . count($objects) . ';plan:' . $planCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get bugs.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param int $product
|
||||
* @param int $execution
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBugsTest($begin, $end, $product, $execution)
|
||||
{
|
||||
$begin = date('Y-m-d', strtotime(date('Y-m-d') . $begin));
|
||||
$end = date('Y-m-d', strtotime(date('Y-m-d') . $end));
|
||||
$objects = $this->objectModel->getBugs($begin, $end, $product, $execution);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = array();
|
||||
foreach($objects as $user => $types)
|
||||
{
|
||||
$count[$user] = '';
|
||||
foreach($types as $type => $typeCount) $count[$user] .= "$type:$typeCount;";
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getWorkloadTest($dept = 0, $assign = 'assign')
|
||||
{
|
||||
$objects = $this->objectModel->getWorkload($dept = 0, $assign = 'assign');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get bug assign.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getBugAssignTest()
|
||||
{
|
||||
$objects = $this->objectModel->getBugAssign();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = array();
|
||||
foreach($objects as $user => $object) $count[$user] = $object['total']['count'];
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getSysURLTest()
|
||||
{
|
||||
$objects = $this->objectModel->getSysURL();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserBugsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserBugs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserTasksTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserTasks();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserTodosTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserTodos();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserTestTasksTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserTestTasks();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearLoginsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearLogins($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearActionsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearActions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearContributionsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearContributions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearTodosTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearTodos($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearEffortsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearEfforts($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearProductsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearProducts($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserYearExecutionsTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getUserYearExecutions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get status stat that is all time, include story, task and bug.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAllTimeStatusStatTest()
|
||||
{
|
||||
$objects = $this->objectModel->getAllTimeStatusStat();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$types = array();
|
||||
foreach($objects as $type => $status)
|
||||
{
|
||||
$types[$type] = '';
|
||||
foreach($status as $statusType => $statusCount) $types[$type] .= "$statusType:$statusCount;";
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
public function getYearObjectStatTest($accounts, $year, $objectType)
|
||||
{
|
||||
$objects = $this->objectModel->getYearObjectStat($accounts, $year, $objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getYearCaseStatTest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getYearCaseStat($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getYearMonthsTest($year)
|
||||
{
|
||||
$objects = $this->objectModel->getYearMonths($year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getStatusOverviewTest($objectType, $statusStat)
|
||||
{
|
||||
$objects = $this->objectModel->getStatusOverview($objectType, $statusStat);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getProjectStatusOverviewTest($accounts = array())
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStatusOverview($accounts = array());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get output data for API.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @param string $year
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getOutput4APITest($accounts, $year)
|
||||
{
|
||||
$objects = $this->objectModel->getOutput4API($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$output = '';
|
||||
foreach($objects as $objectType => $object) $output .= "$objectType:" . $object['total'] . ";";
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getProjectExecutionsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectExecutions();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -65,7 +65,7 @@ fields:
|
||||
- field: openedBy
|
||||
range: admin
|
||||
- field: openedDate
|
||||
range: "(-1M)-(+1w):60"
|
||||
range: "(-1M)-(+1w):-1D"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD hh:mm:ss"
|
||||
- field: openedBuild
|
||||
@@ -73,7 +73,7 @@ fields:
|
||||
- field: assignedTo
|
||||
range: [admin,dev1,test1]{30},[]{20},[admin,dev1,test1]{20},[]{10},closed{20}
|
||||
- field: assignedDate
|
||||
range: "(-1M)-(+1w):60"
|
||||
range: "(-1M)-(+1w):-1D"
|
||||
type: timestamp
|
||||
format: "YYYY-MM-DD"
|
||||
- field: deadline
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->computePercent();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试 bug按照 模块 分组 的百分比 >> 0:0.9714;1821:0.0032;1822:0.0032;1823:0.0032;1825:0.0032;1826:0.0032;1827:0.0032;1831:0.0032;1832:0.0032;1833:0.003;
|
||||
测试 bug按照 版本 分组 的百分比 >> 0:0.0095;trunk:0.9238;1:0.019;11:0.019;12:0.0032;13:0.0032;14:0.0032;15:0.0032;16:0.0032;17:0.0032;18:0.0032;19:0.0032;20:0.0031;
|
||||
测试 bug按照 严重程度 分组 的百分比 >> 1:0.2508;2:0.2508;3:0.2508;4:0.2476;
|
||||
测试 bug按照 解决方案 分组 的百分比 >> fixed:0.3;duplicate:0.2;bydesign:0.12;external:0.12;willnotfix:0.12;postponed:0.08;notrepro:0.06;
|
||||
测试 bug按照 优先级 分组 的百分比 >> 1:0.2508;2:0.2508;3:0.2508;4:0.2476;
|
||||
测试 bug按照 类型 分组 的百分比 >> codeerror:0.1556;config:0.1079;install:0.1079;security:0.1048;performance:0.1048;standard:0.1048;automation:0.1048;designdefect:0.1048;others:0.10
|
||||
|
||||
*/
|
||||
$report = new reportTest();
|
||||
|
||||
global $tester;
|
||||
$bug = $tester->loadModel('bug');
|
||||
|
||||
$bugsPerModule = $bug->getDataOfBugsPerModule();
|
||||
$bugsPerBuild = $bug->getDataOfBugsPerBuild();
|
||||
$bugsPerSeverity = $bug->getDataOfBugsPerSeverity();
|
||||
$bugsPerResolution = $bug->getDataOfBugsPerResolution();
|
||||
$bugsPerPri = $bug->getDataOfBugsPerPri();
|
||||
$bugsPerType = $bug->getDataOfBugsPerType();
|
||||
|
||||
r($report->computePercentTest($bugsPerModule)) && p() && e('0:0.9714;1821:0.0032;1822:0.0032;1823:0.0032;1825:0.0032;1826:0.0032;1827:0.0032;1831:0.0032;1832:0.0032;1833:0.003;'); // 测试 bug按照 模块 分组 的百分比
|
||||
r($report->computePercentTest($bugsPerBuild)) && p() && e('0:0.0095;trunk:0.9238;1:0.019;11:0.019;12:0.0032;13:0.0032;14:0.0032;15:0.0032;16:0.0032;17:0.0032;18:0.0032;19:0.0032;20:0.0031;'); // 测试 bug按照 版本 分组 的百分比
|
||||
r($report->computePercentTest($bugsPerSeverity)) && p() && e('1:0.2508;2:0.2508;3:0.2508;4:0.2476;'); // 测试 bug按照 严重程度 分组 的百分比
|
||||
r($report->computePercentTest($bugsPerResolution)) && p() && e('fixed:0.3;duplicate:0.2;bydesign:0.12;external:0.12;willnotfix:0.12;postponed:0.08;notrepro:0.06;'); // 测试 bug按照 解决方案 分组 的百分比
|
||||
r($report->computePercentTest($bugsPerPri)) && p() && e('1:0.2508;2:0.2508;3:0.2508;4:0.2476;'); // 测试 bug按照 优先级 分组 的百分比
|
||||
r($report->computePercentTest($bugsPerType)) && p() && e('codeerror:0.1556;config:0.1079;install:0.1079;security:0.1048;performance:0.1048;standard:0.1048;automation:0.1048;designdefect:0.1048;others:0.10'); // 测试 bug按照 类型 分组 的百分比
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->convertFormat();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取 2022-01-01 到 2022-01-05 的日期列表 >> 2022-01-03,2022-01-04,2022-01-05
|
||||
测试获取 2022-01-06 到 2022-01-10 的日期列表 >> 2022-01-06,2022-01-07,2022-01-10
|
||||
测试获取 2022-01-11 到 2022-01-15 的日期列表 >> 2022-01-11,2022-01-12,2022-01-13,2022-01-14
|
||||
测试获取 2022-01-16 到 2022-01-20 的日期列表 >> 2022-01-17,2022-01-18,2022-01-19,2022-01-20
|
||||
测试获取 2022-01-01 到 2022-01-05 的日期列表 >> 2022-01-01,2022-01-02,2022-01-03,2022-01-04,2022-01-05
|
||||
测试获取 2022-01-06 到 2022-01-10 的日期列表 >> 2022-01-06,2022-01-07,2022-01-08,2022-01-09,2022-01-10
|
||||
测试获取 2022-01-11 到 2022-01-15 的日期列表 >> 2022-01-11,2022-01-12,2022-01-13,2022-01-14,2022-01-15
|
||||
测试获取 2022-01-16 到 2022-01-20 的日期列表 >> 2022-01-16,2022-01-17,2022-01-18,2022-01-19,2022-01-20
|
||||
|
||||
*/
|
||||
$report = new reportTest();
|
||||
|
||||
global $tester;
|
||||
$execution = $tester->loadModel('execution');
|
||||
|
||||
$date1 = $execution->getDateList('2022-01-01', '2022-01-05', 'noweekend');
|
||||
$date2 = $execution->getDateList('2022-01-06', '2022-01-10', 'noweekend');
|
||||
$date3 = $execution->getDateList('2022-01-11', '2022-01-15', 'noweekend');
|
||||
$date4 = $execution->getDateList('2022-01-16', '2022-01-20', 'noweekend');
|
||||
$date5 = $execution->getDateList('2022-01-01', '2022-01-05', 'withweekend');
|
||||
$date6 = $execution->getDateList('2022-01-06', '2022-01-10', 'withweekend');
|
||||
$date7 = $execution->getDateList('2022-01-11', '2022-01-15', 'withweekend');
|
||||
$date8 = $execution->getDateList('2022-01-16', '2022-01-20', 'withweekend');
|
||||
|
||||
r($report->convertFormatTest($date1[0])) && p() && e('2022-01-03,2022-01-04,2022-01-05'); // 测试获取 2022-01-01 到 2022-01-05 的日期列表
|
||||
r($report->convertFormatTest($date2[0])) && p() && e('2022-01-06,2022-01-07,2022-01-10'); // 测试获取 2022-01-06 到 2022-01-10 的日期列表
|
||||
r($report->convertFormatTest($date3[0])) && p() && e('2022-01-11,2022-01-12,2022-01-13,2022-01-14'); // 测试获取 2022-01-11 到 2022-01-15 的日期列表
|
||||
r($report->convertFormatTest($date4[0])) && p() && e('2022-01-17,2022-01-18,2022-01-19,2022-01-20'); // 测试获取 2022-01-16 到 2022-01-20 的日期列表
|
||||
r($report->convertFormatTest($date5[0])) && p() && e('2022-01-01,2022-01-02,2022-01-03,2022-01-04,2022-01-05'); // 测试获取 2022-01-01 到 2022-01-05 的日期列表
|
||||
r($report->convertFormatTest($date6[0])) && p() && e('2022-01-06,2022-01-07,2022-01-08,2022-01-09,2022-01-10'); // 测试获取 2022-01-06 到 2022-01-10 的日期列表
|
||||
r($report->convertFormatTest($date7[0])) && p() && e('2022-01-11,2022-01-12,2022-01-13,2022-01-14,2022-01-15'); // 测试获取 2022-01-11 到 2022-01-15 的日期列表
|
||||
r($report->convertFormatTest($date8[0])) && p() && e('2022-01-16,2022-01-17,2022-01-18,2022-01-19,2022-01-20'); // 测试获取 2022-01-16 到 2022-01-20 的日期列表
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->createSingleJSON();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取执行 101 的json数据 >> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
测试获取执行 102 的json数据 >> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
测试获取执行 103 的json数据 >> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
测试获取执行 104 的json数据 >> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12]
|
||||
测试获取执行 105 的json数据 >> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
|
||||
*/
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
$executionID = array(101, 102, 103, 104, 105);
|
||||
|
||||
r($report->createSingleJSONTest($executionID[0])) && p() && e('[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'); // 测试获取执行 101 的json数据
|
||||
r($report->createSingleJSONTest($executionID[1])) && p() && e('[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'); // 测试获取执行 102 的json数据
|
||||
r($report->createSingleJSONTest($executionID[2])) && p() && e('[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'); // 测试获取执行 103 的json数据
|
||||
r($report->createSingleJSONTest($executionID[3])) && p() && e('[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12]'); // 测试获取执行 104 的json数据
|
||||
r($report->createSingleJSONTest($executionID[4])) && p() && e('[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'); // 测试获取执行 105 的json数据
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getAllTimeStatusStat();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取 需求 的状态分组个数 >> changed:81;active:93;draft:51;
|
||||
测试获取 任务 的状态分组个数 >> wait:152;doing:152;done:152;pause:152;cancel:151;closed:151;
|
||||
测试获取 bug 的状态分组个数 >> active:135;resolved:90;closed:60;
|
||||
|
||||
*/
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
r($report->getAllTimeStatusStatTest()) && p('story') && e('changed:81;active:93;draft:51;'); // 测试获取 需求 的状态分组个数
|
||||
r($report->getAllTimeStatusStatTest()) && p('task') && e('wait:152;doing:152;done:152;pause:152;cancel:151;closed:151;'); // 测试获取 任务 的状态分组个数
|
||||
r($report->getAllTimeStatusStatTest()) && p('bug') && e('active:135;resolved:90;closed:60;'); // 测试获取 bug 的状态分组个数
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getBugAssign();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取指派给 admin 的bug数量 >> 85
|
||||
获取指派给 dev1 的bug数量 >> 35
|
||||
获取指派给 test1 的bug数量 >> 5
|
||||
|
||||
*/
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
r($report->getBugAssignTest()) && p('admin') && e('85'); // 获取指派给 admin 的bug数量
|
||||
r($report->getBugAssignTest()) && p('dev1') && e('35'); // 获取指派给 dev1 的bug数量
|
||||
r($report->getBugAssignTest()) && p('test1') && e('5'); // 获取指派给 test1 的bug数量
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getBugs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取 -40 day 到 -29 day 产品 1 执行 101 的bug >> :4;all:4;validRate:0;
|
||||
测试获取 -28 day 到 -25 day 产品 2 执行 102 的bug >> :3;all:3;validRate:0;
|
||||
测试获取 -24 day 到 -21 day 产品 3 执行 103 的bug >> :2;all:2;validRate:0;
|
||||
测试获取 -20 day 到 -19 day 产品 4 执行 104 的bug >> :1;all:1;validRate:0;
|
||||
测试获取 -20 day 到 -16 day 产品 5 执行 105 的bug >> :3;all:3;validRate:0;
|
||||
|
||||
*/
|
||||
|
||||
$begin = array(' -40 day', ' -28 day', ' -24 day', ' -20 day', ' -20 day');
|
||||
$end = array(' -29 day', ' -25 day', ' -21 day', ' -19 day', ' -16 day');
|
||||
$productID = array(1, 2, 3, 4, 5);
|
||||
$executionID = array(101, 102, 103, 104, 105);
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
r($report->getBugsTest($begin[0], $end[0], $productID[0], $executionID[0])) && p('admin') && e(':4;all:4;validRate:0;'); // 测试获取 -40 day 到 -29 day 产品 1 执行 101 的bug
|
||||
r($report->getBugsTest($begin[1], $end[1], $productID[1], $executionID[1])) && p('admin') && e(':3;all:3;validRate:0;'); // 测试获取 -28 day 到 -25 day 产品 2 执行 102 的bug
|
||||
r($report->getBugsTest($begin[2], $end[2], $productID[2], $executionID[2])) && p('admin') && e(':2;all:2;validRate:0;'); // 测试获取 -24 day 到 -21 day 产品 3 执行 103 的bug
|
||||
r($report->getBugsTest($begin[3], $end[3], $productID[3], $executionID[3])) && p('admin') && e(':1;all:1;validRate:0;'); // 测试获取 -20 day 到 -19 day 产品 4 执行 104 的bug
|
||||
r($report->getBugsTest($begin[4], $end[4], $productID[4], $executionID[4])) && p('admin') && e(':3;all:3;validRate:0;'); // 测试获取 -20 day 到 -16 day 产品 5 执行 105 的bug
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getExecutions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试查询 开始时间 0 结束时间 0 的执行 >> 151:30,15,项目51;183:15,30,项目83;121:27,15,项目21;111:27,12,项目11;107:30,35,项目7;103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;
|
||||
测试查询 开始时间大于 -40 day 结束时间小于 -10 day 的执行 >> 103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;
|
||||
测试查询 开始时间大于 -28 day 结束时间小于 +5 day 的执行 >> 107:30,35,项目7;103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;
|
||||
测试查询 开始时间大于 -24 day 结束时间小于 +10 day 的执行 >> 111:27,12,项目11;107:30,35,项目7;
|
||||
测试查询 开始时间大于 -20 day 结束时间小于 +15 day 的执行 >> 111:27,12,项目11;
|
||||
测试查询 开始时间大于 -20 day 结束时间小于 +20 day 的执行 >> 121:27,15,项目21;
|
||||
|
||||
*/
|
||||
|
||||
$begin = array('0', ' -70 day', ' -60 day', ' -55 day', ' -50 day', ' -40 day');
|
||||
$end = array('0', ' +10 day', ' +15 day', ' +20 day', ' +25 day', ' +30 day');
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
global $tester;
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('closed')->where('id')->in('101,102,103,107,111,121,151,183')->exec();
|
||||
|
||||
r($report->getExecutionsTest($begin[0], $end[0])) && p() && e('151:30,15,项目51;183:15,30,项目83;121:27,15,项目21;111:27,12,项目11;107:30,35,项目7;103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;'); // 测试查询 开始时间 0 结束时间 0 的执行
|
||||
r($report->getExecutionsTest($begin[1], $end[1])) && p() && e('103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;'); // 测试查询 开始时间大于 -40 day 结束时间小于 -10 day 的执行
|
||||
r($report->getExecutionsTest($begin[2], $end[2])) && p() && e('107:30,35,项目7;103:23,35,项目3;102:9,18,项目2;101:3,15,项目1;'); // 测试查询 开始时间大于 -28 day 结束时间小于 +5 day 的执行
|
||||
r($report->getExecutionsTest($begin[3], $end[3])) && p() && e('111:27,12,项目11;107:30,35,项目7;'); // 测试查询 开始时间大于 -24 day 结束时间小于 +10 day 的执行
|
||||
r($report->getExecutionsTest($begin[4], $end[4])) && p() && e('111:27,12,项目11;'); // 测试查询 开始时间大于 -20 day 结束时间小于 +15 day 的执行
|
||||
r($report->getExecutionsTest($begin[5], $end[5])) && p() && e('121:27,15,项目21;'); // 测试查询 开始时间大于 -20 day 结束时间小于 +20 day 的执行
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('wait')->where('id')->in('101,103,107,111,121,151,183')->exec();
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('doing')->where('id')->in('102')->exec();
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getOutput4API();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取 admin 2022 的输出 >> case:70;
|
||||
测试获取 dev17 2022 的输出 >> bug:1;case:0;
|
||||
测试获取 test18 2022 的输出 >> productplan:1;case:0;
|
||||
|
||||
*/
|
||||
$account = array('admin', 'dev17', 'test18');
|
||||
$year = 2022;
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
r($report->getOutput4APITest($account[0], $year)) && p() && e('case:70;'); // 测试获取 admin 2022 的输出
|
||||
r($report->getOutput4APITest($account[1], $year)) && p() && e('bug:1;case:0;'); // 测试获取 dev17 2022 的输出
|
||||
r($report->getOutput4APITest($account[2], $year)) && p() && e('productplan:1;case:0;'); // 测试获取 test18 2022 的输出
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/report.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 reportModel->getProducts();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
$conditions = array('', 'closedProduct', 'overduePlan');
|
||||
$storyType = 'requirement';
|
||||
|
||||
$report = new reportTest();
|
||||
|
||||
r($report->getProductsTest($conditions[0])) && p() && e(''); // 测试获取 story 产品
|
||||
r($report->getProductsTest($conditions[1])) && p() && e(''); // 测试获取 story closedProduct 产品
|
||||
r($report->getProductsTest($conditions[2])) && p() && e(''); // 测试获取 story overduePlan 产品
|
||||
r($report->getProductsTest($conditions[0], $storyType)) && p() && e(''); // 测试获取 requirement 产品
|
||||
r($report->getProductsTest($conditions[1], $storyType)) && p() && e(''); // 测试获取 requirement closedProduct 产品
|
||||
r($report->getProductsTest($conditions[2], $storyType)) && p() && e(''); // 测试获取 requirement overduePlan 产品
|
||||
@@ -82,6 +82,9 @@ switch($argv[1])
|
||||
case 'branch':
|
||||
ztfRun('model/branch');
|
||||
break;
|
||||
case 'report':
|
||||
ztfRun('model/report');
|
||||
break;
|
||||
case 'tree':
|
||||
ztfRun('model/tree');
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user