diff --git a/test/class/execution.class.php b/test/class/execution.class.php index 0bb079d5ac..5dfe58cbeb 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -1012,7 +1012,7 @@ class executionTest } } - public function fixFirstTest($executionID, $count, $param = array()) + public function fixFirstTest($executionID, $param = array()) { global $tester; $date = date('Y-m-d'); @@ -1028,10 +1028,6 @@ class executionTest $error = dao::getError(); return $error; } - elseif($count == "1") - { - return count($object); - } else { if(empty($object)) @@ -1062,4 +1058,231 @@ class executionTest return $object; } } + + public function processBurnDataTest($executionID, $itemCounts, $begin, $end, $count) + { + global $tester; + $sets = $tester->dao->select('execution, `date` as name, `left` as value')->from(TABLE_BURN)->where('execution')->eq($executionID)->fetchAll('name'); + $object = $this->objectModel->processBurnData($sets, $itemCounts, $begin, $end); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == "1") + { + return count($object); + } + else + { + return $object; + } + } + + public function summaryTest($executionID) + { + global $tester; + $execution = $tester->dbh->query("select * from zt_project where id = $executionID")->fetch(); + $executions = array($executionID => $execution->name); + $page = 'NULL'; + $tasks = $this->objectModel->getTasks('0', $executionID, $executions,'all', '0', '0', 'status,id_desc', $page); + $object = $this->objectModel->summary($tasks); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $object; + } + } + + public function isClickableTest($execution, $action) + { + $object = $this->objectModel->isClickable($execution, $action); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + if($object == true) + { + return "检查通过"; + } + else + { + return "检查不通过"; + } + } + } + + public function getDateListTest($begin, $end, $type, $count, $interval = 0) + { + $object = $this->objectModel->getDateList($begin, $end, $type, $interval); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + elseif($count == "1") + { + return count($object[0]); + } + else + { + if(empty($object[0])) + { + return '无数据'; + } + else + { + return $object; + } + } + } + + public function getTotalEstimateTest($executionID) + { + $object = $this->objectModel->getTotalEstimate($executionID); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $object; + } + } + + public function fixOrderTest() + { + global $tester; + $this->objectModel->fixOrder(); + $object = $tester->dao->select('id,`order`')->from(TABLE_EXECUTION)->fetchAll('id'); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + else + { + return $object; + } + } + + public function getKanbanTasksTest($executionID, $count) + { + $object = $this->objectModel->getKanbanTasks($executionID); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanSettingTest($count) + { + $object = $this->objectModel->getKanbanSetting(); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object->colorList); + } + else + { + return $object; + } + } + + public function getKanbanColumnsTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanColumns($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanStatusMapTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanStatusMap($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanStatusListTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanStatusList($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanColorListTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanColorList($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } } diff --git a/test/model/execution/fixFirst.php b/test/model/execution/fixFirst.php index 9f83aab0e9..a05e4fb500 100755 --- a/test/model/execution/fixFirst.php +++ b/test/model/execution/fixFirst.php @@ -26,6 +26,6 @@ $withLeft = array('estimate' => '21', 'withLeft' => '1'); $waterfallEstimate = array('estimate' => '17', 'withLeft' => '1'); $execution = new executionTest(); -r($execution->fixFirstTest($executionIDList[0], $scrumEstimate)) && p('0:estimate') && e('26'); // 敏捷执行更新首日工时 +r($execution->fixFirstTest($executionIDList[0], $scrumEstimate)) && p('0:estimate') && e('26'); // 不传入withLeft r($execution->fixFirstTest($executionIDList[0], $withLeft)) && p('0:estimate') && e('26'); // 敏捷执行更新首日剩余工时 r($execution->fixFirstTest($executionIDList[1], $waterfallEstimate)) && p('0:left') && e('17'); // 瀑布执行更新首日剩余工时 diff --git a/test/model/execution/fixOrder.php b/test/model/execution/fixOrder.php new file mode 100755 index 0000000000..1f9faa817e --- /dev/null +++ b/test/model/execution/fixOrder.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +fixOrderTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$execution = new executionTest(); +r($execution->fixOrderTest()) && p('101:order') && e('15'); // 重置order diff --git a/test/model/execution/getDateList.php b/test/model/execution/getDateList.php new file mode 100755 index 0000000000..e688970eb3 --- /dev/null +++ b/test/model/execution/getDateList.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getDateListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$start = array('2022-01-01', '2025-01-01'); +$end = array('2022-01-07', '2025-01-07'); +$count = array('0', '1'); +$type = array('noweekend', 'week'); + +$execution = new executionTest(); +r($execution->getDateListTest($start[0], $end[0], $type[0] ,$count[0])) && p('0:0') && e('01/03/2022'); // 去除工作日日期列表 +r($execution->getDateListTest($start[0], $end[0], $type[0] ,$count[1])) && p() && e('5'); // 去除工作日日期列表统计 +r($execution->getDateListTest($start[0], $end[0], $type[1] ,$count[0])) && p('0:0') && e('01/01/2022'); // 未去除工作日日期列表 +r($execution->getDateListTest($start[0], $end[0], $type[1] ,$count[1])) && p() && e('7'); // 未去除工作日日期列表统计 +r($execution->getDateListTest($start[1], $end[0], $type[1] ,$count[0])) && p() && e('无数据'); // 日期输入错误查询 diff --git a/test/model/execution/getKanbanColorList.php b/test/model/execution/getKanbanColorList.php new file mode 100755 index 0000000000..77762eb997 --- /dev/null +++ b/test/model/execution/getKanbanColorList.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanColorListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanColorListTest($count[0])) && p('wait') && e('#7EC5FF'); // 看板状态颜色查询 +r($execution->getKanbanColorListTest($count[1])) && p() && e('6'); // 看板状态颜色数量统计 diff --git a/test/model/execution/getKanbanColumns.php b/test/model/execution/getKanbanColumns.php new file mode 100755 index 0000000000..1867f63bf1 --- /dev/null +++ b/test/model/execution/getKanbanColumns.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanColumnsTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanColumnsTest($count[0])[0]) && p() && e('wait'); // 看板列查询 +r($execution->getKanbanColumnsTest($count[1])) && p() && e('6'); // 看板列查询统计 diff --git a/test/model/execution/getKanbanGroupData.php b/test/model/execution/getKanbanGroupData.php new file mode 100755 index 0000000000..be6944fd1f --- /dev/null +++ b/test/model/execution/getKanbanGroupData.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getKanbanGroupDataTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$count = array('0', '1'); + +$execution = new executionTest(); +var_dump($execution->getKanbanGroupDataTest($executionIDList[0], $count[0]));die; +r($execution->getKanbanGroupDataTest($executionIDList[0], $count[0])) && p('906:name,execution') && e('子任务6,101'); // 敏捷执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[1], $count[0])) && p('693:name,execution') && e('更多任务93,131'); // 瀑布执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[2], $count[0])) && p('61:name,execution') && e('开发任务71,161'); // 看板执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[0], $count[1])) && p() && e('11'); // 敏捷执行查询统计 +r($execution->getKanbanGroupDataTest($executionIDList[1], $count[1])) && p() && e('4'); // 瀑布执行查询统计 +r($execution->getKanbanGroupDataTest($executionIDList[2], $count[1])) && p() && e('4'); // 看板执行查询统计 diff --git a/test/model/execution/getKanbanSetting.php b/test/model/execution/getKanbanSetting.php new file mode 100755 index 0000000000..39b11ee23a --- /dev/null +++ b/test/model/execution/getKanbanSetting.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanSettingTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanSettingTest($count[0])) && p('colorList:wait') && e('#7EC5FF'); // 看板设置查询 +r($execution->getKanbanSettingTest($count[1])) && p() && e('6'); // 看板设置查询统计 diff --git a/test/model/execution/getKanbanStatusList.php b/test/model/execution/getKanbanStatusList.php new file mode 100755 index 0000000000..228ac14a0a --- /dev/null +++ b/test/model/execution/getKanbanStatusList.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanStatusListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanStatusListTest($count[0])) && p('wait') && e('未开始');// 看板状态列表查询 +r($execution->getKanbanStatusListTest($count[1])) && p() && e('7'); // 看板状态列表数量统计 diff --git a/test/model/execution/getKanbanStatusMap.php b/test/model/execution/getKanbanStatusMap.php new file mode 100755 index 0000000000..25758d862e --- /dev/null +++ b/test/model/execution/getKanbanStatusMap.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getKanbanStatusMapTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanStatusMapTest($count[0])["task"]) && p('wait:doing') && e('start'); // 看板tesk查询 +r($execution->getKanbanStatusMapTest($count[0])["bug"]) && p('wait:done') && e('resolve'); // 看板bug查询 +r($execution->getKanbanStatusMapTest($count[1])) && p() && e('2'); // 看板统计 diff --git a/test/model/execution/getKanbanTasks.php b/test/model/execution/getKanbanTasks.php new file mode 100755 index 0000000000..6708a867c6 --- /dev/null +++ b/test/model/execution/getKanbanTasks.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +getKanbanTasksTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanTasksTest($executionIDList[0], $count[0])) && p('906:name,execution') && e('子任务6,101'); // 敏捷执行查询 +r($execution->getKanbanTasksTest($executionIDList[1], $count[0])) && p('693:name,execution') && e('更多任务93,131'); // 瀑布执行查询 +r($execution->getKanbanTasksTest($executionIDList[2], $count[0])) && p('61:name,execution') && e('开发任务71,161'); // 看板执行查询 +r($execution->getKanbanTasksTest($executionIDList[0], $count[1])) && p() && e('11'); // 敏捷执行查询统计 +r($execution->getKanbanTasksTest($executionIDList[1], $count[1])) && p() && e('4'); // 瀑布执行查询统计 +r($execution->getKanbanTasksTest($executionIDList[2], $count[1])) && p() && e('4'); // 看板执行查询统计 diff --git a/test/model/execution/getTotalEstimate.php b/test/model/execution/getTotalEstimate.php new file mode 100755 index 0000000000..c2c239188b --- /dev/null +++ b/test/model/execution/getTotalEstimate.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +getTotalEstimateTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); + +$execution = new executionTest(); +r($execution->getTotalEstimateTest($executionIDList[0])) && p() && e('48'); // 敏捷执行预计工时统计 +r($execution->getTotalEstimateTest($executionIDList[1])) && p() && e('17'); // 瀑布执行预计工时统计 +r($execution->getTotalEstimateTest($executionIDList[2])) && p() && e('20'); // 看板执行预计工时统计 +r($execution->getTotalEstimateTest('')) && p() && e('0'); // 无执行预计工时统计 diff --git a/test/model/execution/isClickable.php b/test/model/execution/isClickable.php new file mode 100755 index 0000000000..769246fd7b --- /dev/null +++ b/test/model/execution/isClickable.php @@ -0,0 +1,58 @@ +#!/usr/bin/env php +isClickableTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$waitExecution = new stdclass(); +$doingExecution = new stdclass(); +$suspendedExecution = new stdclass(); +$closedExecution = new stdclass(); + +$waitExecution->status = 'wait'; +$doingExecution->status = 'doing'; +$suspendedExecution->status = 'suspended'; +$closedExecution->status = 'closed'; + +$actionList = array('start', 'close', 'suspend', 'putoff', 'activate', 'delete'); + +$execution = new executionTest(); +r($execution->isClickableTest($waitExecution, $actionList[0])) && p() && e('检查通过'); // wait状态执行start按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[1])) && p() && e('检查通过'); // wait状态执行close按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[2])) && p() && e('检查通过'); // wait状态执行suspend按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[3])) && p() && e('检查通过'); // wait状态执行putoff按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[4])) && p() && e('检查不通过'); // wait状态执行activate按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[5])) && p() && e('检查通过'); // wait状态执行delete按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[0])) && p() && e('检查不通过'); // doing状态执行start按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[1])) && p() && e('检查通过'); // doing状态执行close按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[2])) && p() && e('检查通过'); // doing状态执行suspend按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[3])) && p() && e('检查通过'); // doing状态执行putoff按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[4])) && p() && e('检查不通过'); // doing状态执行activate按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[5])) && p() && e('检查通过'); // doing状态执行delete按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[0])) && p() && e('检查不通过'); // suspended状态执行start按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[1])) && p() && e('检查通过'); // suspended状态执行close按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[2])) && p() && e('检查不通过'); // suspended状态执行suspend按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[3])) && p() && e('检查不通过'); // suspended状态执行putoff按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[4])) && p() && e('检查通过'); // suspended状态执行activate按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[5])) && p() && e('检查不通过'); // suspended状态执行delete按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[0])) && p() && e('检查不通过'); // closed状态执行start按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[1])) && p() && e('检查不通过'); // closed状态执行close按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[2])) && p() && e('检查不通过'); // closed状态执行suspend按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[3])) && p() && e('检查不通过'); // closed状态执行putoff按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[4])) && p() && e('检查通过'); // closed状态执行activate按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[5])) && p() && e('检查不通过'); // closed状态执行delete按钮检查 diff --git a/test/model/execution/processBurnData.php b/test/model/execution/processBurnData.php new file mode 100755 index 0000000000..ff57e7f538 --- /dev/null +++ b/test/model/execution/processBurnData.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +processBurnDataTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$itemCounts = array('30', '60', '100'); +$begin = array('2022-01-15','2022-03-22'); +$end = array('2022-03-22','2022-01-15'); +$count = array('0','1'); + +$execution = new executionTest(); +r($execution->processBurnDataTest($executionIDList[0], $itemCounts[0], $begin[0], $end[0], $count[1])) && p() && e('29'); // 敏捷执行查询统计 +r($execution->processBurnDataTest($executionIDList[1], $itemCounts[1], $begin[0], $end[0], $count[1])) && p() && e('60'); // 瀑布执行查询统计 +r($execution->processBurnDataTest($executionIDList[2], $itemCounts[2], $begin[0], $end[0], $count[1])) && p() && e('60'); // 看板执行查询统计 +r($execution->processBurnDataTest($executionIDList[2], $itemCounts[2], $begin[1], $end[1], $count[1])) && p() && e('0'); // 错误时间查询统计 diff --git a/test/model/execution/summary.php b/test/model/execution/summary.php new file mode 100755 index 0000000000..d07aa18617 --- /dev/null +++ b/test/model/execution/summary.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +summaryTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); + +$execution = new executionTest(); +r($execution->summaryTest($executionIDList[0])) && p() && e('本页共 14 个任务,未开始 4,进行中 3,总预计 3 工时,已消耗 15 工时,剩余 3 工时。'); // 敏捷执行任务统计 +r($execution->summaryTest($executionIDList[1])) && p() && e('本页共 4 个任务,未开始 2,进行中 1,总预计 17 工时,已消耗 15 工时,剩余 17 工时。'); // 瀑布执行任务统计 +r($execution->summaryTest($executionIDList[2])) && p() && e('本页共 4 个任务,未开始 2,进行中 1,总预计 20 工时,已消耗 15 工时,剩余 20 工时。'); // 看板执行任务统计