add execution test

This commit is contained in:
liyang
2022-03-15 17:13:16 +08:00
parent 454ee03f10
commit 0fecbc4834
15 changed files with 623 additions and 6 deletions
+228 -5
View File
@@ -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;
}
}
}
+1 -1
View File
@@ -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'); // 瀑布执行更新首日剩余工时
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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('无数据'); // 日期输入错误查询
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板状态颜色数量统计
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板列查询统计
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板执行查询统计
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板设置查询统计
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板状态列表数量统计
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板统计
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 看板执行查询统计
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 无执行预计工时统计
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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按钮检查
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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'); // 错误时间查询统计
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
su('admin');
/**
title=测试executionModel->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('本页共 <strong>14</strong> 个任务,未开始 <strong>4</strong>,进行中 <strong>3</strong>,总预计 <strong>3</strong> 工时,已消耗 <strong>15</strong> 工时,剩余 <strong>3</strong> 工时。'); // 敏捷执行任务统计
r($execution->summaryTest($executionIDList[1])) && p() && e('本页共 <strong>4</strong> 个任务,未开始 <strong>2</strong>,进行中 <strong>1</strong>,总预计 <strong>17</strong> 工时,已消耗 <strong>15</strong> 工时,剩余 <strong>17</strong> 工时。'); // 瀑布执行任务统计
r($execution->summaryTest($executionIDList[2])) && p() && e('本页共 <strong>4</strong> 个任务,未开始 <strong>2</strong>,进行中 <strong>1</strong>,总预计 <strong>20</strong> 工时,已消耗 <strong>15</strong> 工时,剩余 <strong>20</strong> 工时。'); // 看板执行任务统计