From 9d8df16da82a8c0a819762a07eb32f9caef83e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Sat, 9 Apr 2022 15:58:16 +0800 Subject: [PATCH 1/7] * Add testtask. --- module/testtask/js/common.js | 2 +- module/testtask/model.php | 1 + test/class/testtask.class.php | 226 ++++++++++++++++++ test/model/testtask/activate.php | 17 ++ test/model/testtask/batchrun.php | 17 ++ test/model/testtask/block.php | 17 ++ test/model/testtask/close.php | 17 ++ test/model/testtask/create.php | 39 +++ test/model/testtask/createresult.php | 17 ++ test/model/testtask/getalllinkablecases.php | 30 +++ test/model/testtask/getbuginfo.php | 17 ++ test/model/testtask/getbyid.php | 20 ++ test/model/testtask/getbylist.php | 20 ++ test/model/testtask/getbyuser.php | 24 ++ .../testtask/getdataoftesttaskpermodule.php | 17 ++ .../testtask/getdataoftesttaskperrunner.php | 17 ++ .../getdataoftesttaskperrunresult.php | 17 ++ .../testtask/getdataoftesttaskpertype.php | 17 ++ test/model/testtask/getexecutiontasks.php | 25 ++ test/model/testtask/getlinkablecasesbybug.php | 17 ++ .../testtask/getlinkablecasesbystory.php | 17 ++ .../testtask/getlinkablecasesbysuite.php | 17 ++ .../testtask/getlinkablecasesbytesttask.php | 17 ++ test/model/testtask/getpairs.php | 28 +++ test/model/testtask/getproducttasks.php | 28 +++ test/model/testtask/getproductunittasks.php | 19 ++ test/model/testtask/getprojecttasks.php | 25 ++ test/model/testtask/getrelatedtesttasks.php | 17 ++ test/model/testtask/getresults.php | 17 ++ test/model/testtask/getrunbyid.php | 17 ++ test/model/testtask/getruns.php | 17 ++ test/model/testtask/gettaskcases.php | 17 ++ test/model/testtask/gettoandcclist.php | 17 ++ test/model/testtask/getuserruns.php | 17 ++ test/model/testtask/getusertesttaskpairs.php | 17 ++ test/model/testtask/importunitresult.php | 17 ++ test/model/testtask/linkcase.php | 17 ++ test/model/testtask/mergechartoption.php | 17 ++ test/model/testtask/parsecppxmlresult.php | 17 ++ test/model/testtask/parsexmlresult.php | 17 ++ test/model/testtask/parseztffuncresult.php | 17 ++ test/model/testtask/parseztfunitresult.php | 17 ++ test/model/testtask/printcell.php | 17 ++ test/model/testtask/processautoresult.php | 17 ++ test/model/testtask/start.php | 17 ++ test/model/testtask/update.php | 17 ++ 46 files changed, 1047 insertions(+), 1 deletion(-) create mode 100644 test/class/testtask.class.php create mode 100644 test/model/testtask/activate.php create mode 100644 test/model/testtask/batchrun.php create mode 100644 test/model/testtask/block.php create mode 100644 test/model/testtask/close.php create mode 100644 test/model/testtask/create.php create mode 100644 test/model/testtask/createresult.php create mode 100644 test/model/testtask/getalllinkablecases.php create mode 100644 test/model/testtask/getbuginfo.php create mode 100644 test/model/testtask/getbyid.php create mode 100644 test/model/testtask/getbylist.php create mode 100644 test/model/testtask/getbyuser.php create mode 100644 test/model/testtask/getdataoftesttaskpermodule.php create mode 100644 test/model/testtask/getdataoftesttaskperrunner.php create mode 100644 test/model/testtask/getdataoftesttaskperrunresult.php create mode 100644 test/model/testtask/getdataoftesttaskpertype.php create mode 100644 test/model/testtask/getexecutiontasks.php create mode 100644 test/model/testtask/getlinkablecasesbybug.php create mode 100644 test/model/testtask/getlinkablecasesbystory.php create mode 100644 test/model/testtask/getlinkablecasesbysuite.php create mode 100644 test/model/testtask/getlinkablecasesbytesttask.php create mode 100644 test/model/testtask/getpairs.php create mode 100644 test/model/testtask/getproducttasks.php create mode 100644 test/model/testtask/getproductunittasks.php create mode 100644 test/model/testtask/getprojecttasks.php create mode 100644 test/model/testtask/getrelatedtesttasks.php create mode 100644 test/model/testtask/getresults.php create mode 100644 test/model/testtask/getrunbyid.php create mode 100644 test/model/testtask/getruns.php create mode 100644 test/model/testtask/gettaskcases.php create mode 100644 test/model/testtask/gettoandcclist.php create mode 100644 test/model/testtask/getuserruns.php create mode 100644 test/model/testtask/getusertesttaskpairs.php create mode 100644 test/model/testtask/importunitresult.php create mode 100644 test/model/testtask/linkcase.php create mode 100644 test/model/testtask/mergechartoption.php create mode 100644 test/model/testtask/parsecppxmlresult.php create mode 100644 test/model/testtask/parsexmlresult.php create mode 100644 test/model/testtask/parseztffuncresult.php create mode 100644 test/model/testtask/parseztfunitresult.php create mode 100644 test/model/testtask/printcell.php create mode 100644 test/model/testtask/processautoresult.php create mode 100644 test/model/testtask/start.php create mode 100644 test/model/testtask/update.php diff --git a/module/testtask/js/common.js b/module/testtask/js/common.js index 18dffc8e02..98acc21e3f 100644 --- a/module/testtask/js/common.js +++ b/module/testtask/js/common.js @@ -67,7 +67,7 @@ function createBug(obj) } else { - window.open(link, '_parent'); + window.open(link, '_blank'); } config.onlybody = onlybody; diff --git a/module/testtask/model.php b/module/testtask/model.php index 76c13112a9..052fe72036 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -355,6 +355,7 @@ class testtaskModel extends model */ public function getAllLinkableCases($task, $query, $linkedCases, $pager) { + a($query); return $this->dao->select('*')->from(TABLE_CASE)->where($query) ->andWhere('id')->notIN($linkedCases) ->andWhere('status')->ne('wait') diff --git a/test/class/testtask.class.php b/test/class/testtask.class.php new file mode 100644 index 0000000000..df515abc6b --- /dev/null +++ b/test/class/testtask.class.php @@ -0,0 +1,226 @@ +objectModel = $tester->loadModel('testtask'); + } + + /** + * Test create testtask. + * + * @param int $projectID + * @param array $params + * @access public + * @return void + */ + public function create($projectID, $params) + { + $_POST = $params; + $taskID = $this->objectModel->create($projectID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return $this->objectModel->getById($taskID); + } + + public function update($taskID) + { + $objects = $this->objectModel->update($taskID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function startTest($taskID) + { + $objects = $this->objectModel->start($taskID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function closeTest($taskID) + { + $objects = $this->objectModel->close($taskID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function blockTest($taskID) + { + $objects = $this->objectModel->block($taskID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function activateTest($taskID) + { + $objects = $this->objectModel->activate($taskID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function linkCaseTest($taskID, $type) + { + $objects = $this->objectModel->linkCase($taskID, $type); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getRunsTest($taskID, $moduleID, $orderBy, $pager = null) + { + $objects = $this->objectModel->getRuns($taskID, $moduleID, $orderBy, $pager = null); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getUserRunsTest($taskID, $user, $modules = '', $orderBy = 'id_desc', $pager = null) + { + $objects = $this->objectModel->getUserRuns($taskID, $user, $modules = '', $orderBy = 'id_desc', $pager = null); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getTaskCasesTest($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task) + { + $objects = $this->objectModel->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getUserTestTaskPairsTest($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array()) + { + $objects = $this->objectModel->getUserTestTaskPairs($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array()); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getRunByIdTest($runID) + { + $objects = $this->objectModel->getRunById($runID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function createResultTest($runID = 0) + { + $objects = $this->objectModel->createResult($runID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function batchRunTest($runCaseType = 'testcase', $taskID = 0) + { + $objects = $this->objectModel->batchRun($runCaseType = 'testcase', $taskID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getResultsTest($runID, $caseID = 0) + { + $objects = $this->objectModel->getResults($runID, $caseID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function printCellTest($col, $run, $users, $task, $branches, $mode = 'datatable') + { + $objects = $this->objectModel->printCell($col, $run, $users, $task, $branches, $mode = 'datatable'); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getToAndCcListTest($testtask) + { + $objects = $this->objectModel->getToAndCcList($testtask); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function importUnitResultTest($productID) + { + $objects = $this->objectModel->importUnitResult($productID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function processAutoResultTest($testtaskID, $productID, $suites, $cases, $results, $suiteNames = array(), $caseTitles = array(), $auto = 'unit') + { + $objects = $this->objectModel->processAutoResult($testtaskID, $productID, $suites, $cases, $results, $suiteNames = array(), $caseTitles = array(), $auto = 'unit'); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function parseCppXMLResultTest($fileName, $productID, $frame) + { + $objects = $this->objectModel->parseCppXMLResult($fileName, $productID, $frame); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function parseXMLResultTest($fileName, $productID, $frame) + { + $objects = $this->objectModel->parseXMLResult($fileName, $productID, $frame); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function parseZTFUnitResultTest($caseResults, $frame, $productID, $jobID, $compileID) + { + $objects = $this->objectModel->parseZTFUnitResult($caseResults, $frame, $productID, $jobID, $compileID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function parseZTFFuncResultTest($caseResults, $frame, $productID, $jobID, $compileID) + { + $objects = $this->objectModel->parseZTFFuncResult($caseResults, $frame, $productID, $jobID, $compileID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/testtask/activate.php b/test/model/testtask/activate.php new file mode 100644 index 0000000000..b0dd7a65d7 --- /dev/null +++ b/test/model/testtask/activate.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +activate(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->activateTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/batchrun.php b/test/model/testtask/batchrun.php new file mode 100644 index 0000000000..e6432d9995 --- /dev/null +++ b/test/model/testtask/batchrun.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +batchRun(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->batchRunTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/block.php b/test/model/testtask/block.php new file mode 100644 index 0000000000..9389ae2600 --- /dev/null +++ b/test/model/testtask/block.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +block(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->blockTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/close.php b/test/model/testtask/close.php new file mode 100644 index 0000000000..6118e0e800 --- /dev/null +++ b/test/model/testtask/close.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +close(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->closeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/create.php b/test/model/testtask/create.php new file mode 100644 index 0000000000..580fe3c374 --- /dev/null +++ b/test/model/testtask/create.php @@ -0,0 +1,39 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +$normalTask['product'] = 1; +$normalTask['execution'] = 200; +$normalTask['build'] = 11; +$normalTask['type'] = 'system'; +$normalTask['owner'] = 'test10'; +$normalTask['pri'] = 3; +$normalTask['begin'] = '2022-03-05'; +$normalTask['end'] = '2022-09-05'; +$normalTask['status'] = 'wait'; +$normalTask['name'] = '新增测试单'; +$normalTask['desc'] = '新增测试单的描述详情'; + +$emptyNameTask = $normalTask; +$emptyNameTask['name'] = ''; + +$beginGtEndTask = $normalTask; +$beginGtEndTask['begin'] = '2022-10-05'; + +r($testtask->create(11, $normalTask)) && p('id,name,execution,product,type') && e('11,新增测试报告,200,1,system'); // 新增一个正常的测试单 +r($testtask->create(12, $emptyNameTask)) && p('name:0') && e('『名称』不能为空。'); // 新增一个名称为空的测试单 +r($testtask->create(13, $beginGtEndTask)) && p('end:0') && e('『结束日期』应当不小于『2022-10-05』。'); // 新增一个结束日期小于开始日期的测试单 + +system('./ztest init'); diff --git a/test/model/testtask/createresult.php b/test/model/testtask/createresult.php new file mode 100644 index 0000000000..86b7d104d2 --- /dev/null +++ b/test/model/testtask/createresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +createResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->createResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getalllinkablecases.php b/test/model/testtask/getalllinkablecases.php new file mode 100644 index 0000000000..d5cb3d7524 --- /dev/null +++ b/test/model/testtask/getalllinkablecases.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php +getAllLinkableCases(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); +$tester->app->loadClass('pager', $static = true); + +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); + +$cases1 = $tester->testtask->getAllLinkableCases($task1, '1 = 1', '', $pager); +$cases2 = $tester->testtask->getAllLinkableCases($task2, '1 = 1', '', null); +$cases3 = $tester->testtask->getAllLinkableCases($task2, '1 = 1', '410,408', null); +$cases4 = $tester->testtask->getAllLinkableCases($task2, 'id < 100', '410,408', null); + +r(count($cases1)) && p() && e('10'); // 获取可关联到测试单1的用例列表,每页10条,查看数量 +r(count($cases2)) && p() && e('307'); // 获取可关联到测试单2的用例列表,查看数量 +r(count($cases3)) && p() && e('305'); // 获取可关联到测试单2的用例列表,传入已关联的用例ID,查看数量 +r(count($cases4)) && p() && e('74'); // 获取可关联到测试单2的用例列表,传入sql语句,查看数量 diff --git a/test/model/testtask/getbuginfo.php b/test/model/testtask/getbuginfo.php new file mode 100644 index 0000000000..403a68f025 --- /dev/null +++ b/test/model/testtask/getbuginfo.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getBugInfo(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getBugInfoTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getbyid.php b/test/model/testtask/getbyid.php new file mode 100644 index 0000000000..83b0917ed6 --- /dev/null +++ b/test/model/testtask/getbyid.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getById(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +r($tester->testtask->getById(0)) && p('') && e('0'); // 获取ID为0的测试单,返回空 +r($tester->testtask->getById(1)) && p('name,buildName,desc,begin,end') && e('测试单1,执行版本版本11,这是测试单描述1,2022-04-08,2022-04-15'); // 获取ID为1的测试单的详细信息 +r($tester->testtask->getById(2)) && p('name,buildName,desc,begin,end') && e('测试单2,执行版本版本12,这是测试单描述2,2022-04-08,2022-04-15'); // 获取ID为2的测试单的详细信息 +r($tester->testtask->getById(3)) && p('name,buildName,desc,begin,end') && e('测试单3,执行版本版本13,这是测试单描述3,2022-04-08,2022-04-15'); // 获取ID为3的测试单的详细信息 diff --git a/test/model/testtask/getbylist.php b/test/model/testtask/getbylist.php new file mode 100644 index 0000000000..415921da8c --- /dev/null +++ b/test/model/testtask/getbylist.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getByList(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$taskIdList = array(1, 2, 3, 4, 5); + +r(count($tester->testtask->getByList($taskIdList))) && p() && e('5'); // 查看按照ID列表获取的测试单的数量 +r($tester->testtask->getByList($taskIdList)) && p('1:name,type,status,begin,end') && e('测试单1,,wait,2022-04-08,2022-04-15'); // 查看按照ID列表获取的测试单的详情 diff --git a/test/model/testtask/getbyuser.php b/test/model/testtask/getbyuser.php new file mode 100644 index 0000000000..79f1eb22c6 --- /dev/null +++ b/test/model/testtask/getbyuser.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getByUser(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +r(count($tester->testtask->getByUser('user3'))) && p() && e('1'); // 获取用户user3的测试单数量 +r(count($tester->testtask->getByUser('user4'))) && p() && e('1'); // 获取用户user4的测试单数量 +r(count($tester->testtask->getByUser('user5'))) && p() && e('1'); // 获取用户user5的测试单数量 +r(count($tester->testtask->getByUser('user6'))) && p() && e('1'); // 获取用户user6的测试单数量 +r($tester->testtask->getByUser('user3')) && p('0:name,type,status,begin,end') && e('测试单1,,wait,2022-04-08,2022-04-15'); // 获取用户user3的测试单详细信息 +r($tester->testtask->getByUser('user4')) && p('0:name,type,status,begin,end') && e('测试单2,,doing,2022-04-08,2022-04-15'); // 获取用户user4的测试单详细信息 +r($tester->testtask->getByUser('user5')) && p('0:name,type,status,begin,end') && e('测试单3,,done,2022-04-08,2022-04-15'); // 获取用户user5的测试单详细信息 +r($tester->testtask->getByUser('user6')) && p('0:name,type,status,begin,end') && e('测试单4,,blocked,2022-04-08,2022-04-15'); // 获取用户user6的测试单详细信息 diff --git a/test/model/testtask/getdataoftesttaskpermodule.php b/test/model/testtask/getdataoftesttaskpermodule.php new file mode 100644 index 0000000000..3d1d01437e --- /dev/null +++ b/test/model/testtask/getdataoftesttaskpermodule.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getDataOfTestTaskPerModule(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getDataOfTestTaskPerModuleTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getdataoftesttaskperrunner.php b/test/model/testtask/getdataoftesttaskperrunner.php new file mode 100644 index 0000000000..f44ebce186 --- /dev/null +++ b/test/model/testtask/getdataoftesttaskperrunner.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getDataOfTestTaskPerRunner(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getDataOfTestTaskPerRunnerTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getdataoftesttaskperrunresult.php b/test/model/testtask/getdataoftesttaskperrunresult.php new file mode 100644 index 0000000000..fdc315b5cd --- /dev/null +++ b/test/model/testtask/getdataoftesttaskperrunresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getDataOfTestTaskPerRunResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getDataOfTestTaskPerRunResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getdataoftesttaskpertype.php b/test/model/testtask/getdataoftesttaskpertype.php new file mode 100644 index 0000000000..bea6f554d2 --- /dev/null +++ b/test/model/testtask/getdataoftesttaskpertype.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getDataOfTestTaskPerType(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getDataOfTestTaskPerTypeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getexecutiontasks.php b/test/model/testtask/getexecutiontasks.php new file mode 100644 index 0000000000..c695907ba7 --- /dev/null +++ b/test/model/testtask/getexecutiontasks.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +getExecutionTasks(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$execution101Tasks = $tester->testtask->getExecutionTasks(101); +$execution110Tasks = $tester->testtask->getExecutionTasks(110); +$execution120Tasks = $tester->testtask->getExecutionTasks(120); + +r(count($execution101Tasks)) && p() && e('1'); // 查看迭代101下的所有测试单数量 +r(count($execution110Tasks)) && p() && e('1'); // 查看迭代110下的所有测试单数量 +r(count($execution120Tasks)) && p() && e('0'); // 查看迭代120下的所有测试单数量 +r($execution101Tasks) && p('1:name,type,status,begin,end') && e('测试单1,,wait,2022-04-08,2022-04-15'); // 查看迭代101下的测试单1的详细信息 +r($execution110Tasks) && p('10:name,type,status,begin,end') && e('测试单10,,doing,2022-04-08,2022-04-15'); // 查看迭代110下的所有测试单10的详细信息 diff --git a/test/model/testtask/getlinkablecasesbybug.php b/test/model/testtask/getlinkablecasesbybug.php new file mode 100644 index 0000000000..72888d689d --- /dev/null +++ b/test/model/testtask/getlinkablecasesbybug.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getLinkableCasesByBug(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getLinkableCasesByBugTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getlinkablecasesbystory.php b/test/model/testtask/getlinkablecasesbystory.php new file mode 100644 index 0000000000..98573bf718 --- /dev/null +++ b/test/model/testtask/getlinkablecasesbystory.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getLinkableCasesByStory(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getLinkableCasesByStoryTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getlinkablecasesbysuite.php b/test/model/testtask/getlinkablecasesbysuite.php new file mode 100644 index 0000000000..372ac2d004 --- /dev/null +++ b/test/model/testtask/getlinkablecasesbysuite.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getLinkableCasesBySuite(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getLinkableCasesBySuiteTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getlinkablecasesbytesttask.php b/test/model/testtask/getlinkablecasesbytesttask.php new file mode 100644 index 0000000000..5e38841f50 --- /dev/null +++ b/test/model/testtask/getlinkablecasesbytesttask.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getLinkableCasesByTestTask(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getLinkableCasesByTestTaskTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getpairs.php b/test/model/testtask/getpairs.php new file mode 100644 index 0000000000..c4cfb4428c --- /dev/null +++ b/test/model/testtask/getpairs.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$appendIdList = array(40, 45, 50); + +$taskPairs1 = $tester->testtask->getPairs(1); +$taskPairs2 = $tester->testtask->getPairs(1, 101); +$taskPairs3 = $tester->testtask->getPairs(1, 101, $appendIdList); + +r(count($taskPairs1)) && p() && e(''); // 获取产品1下的测试单的数量 +r(count($taskPairs2)) && p() && e(''); // 获取产品1下的测试单的数量 +r(count($taskPairs3)) && p() && e(''); // 获取产品1下的测试单的数量 +r($taskPairs1) && p() && e(''); // 获取产品1下的测试单的数量 +r($taskPairs2) && p() && e(''); // 获取产品1下的测试单的数量 +r($taskPairs3) && p() && e(''); // 获取产品1下的测试单的数量 diff --git a/test/model/testtask/getproducttasks.php b/test/model/testtask/getproducttasks.php new file mode 100644 index 0000000000..59008cfa3a --- /dev/null +++ b/test/model/testtask/getproducttasks.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +getProductTasks(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$localScope = array('local', 'totalstatus'); +$allScope = array('all', 'totalstatus'); + +$tasks1 = $tester->testtask->getProductTasks(1, 'all', 'id_desc', null, $localScope); +$tasks2 = $tester->testtask->getProductTasks(2, 'all', 'id_asc', null, $allScope); +$tasks3 = $tester->testtask->getProductTasks(2, 'all', 'id_asc', null, $allScope, '2023-01-01'); + +r(count($tasks1)) && p() && e('2'); // 查看产品1下的测试单的数量 +r(count($tasks2)) && p() && e('11'); // 查看系统中所有测试单的数量 +r(count($tasks3)) && p() && e('0'); // 查看系统中所有截止日期大于2023-01-01的测试单的数量 +r($tasks1) && p('11:name,type,begin,end') && e('新增测试报告,system,2022-03-05,2022-09-05'); // 查看ID为11的测试单的详细信息 +r($tasks2) && p('3:name,type,begin,end') && e('测试单3,,2022-04-08,2022-04-15'); // 查看ID为3的测试单的详细信息 diff --git a/test/model/testtask/getproductunittasks.php b/test/model/testtask/getproductunittasks.php new file mode 100644 index 0000000000..004a85bb86 --- /dev/null +++ b/test/model/testtask/getproductunittasks.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getProductUnitTasks(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$tasks = $tester->testtask->getProductUnitTasks(1, 'all'); + +r($testtask->getProductUnitTasksTest()) && p() && e(); diff --git a/test/model/testtask/getprojecttasks.php b/test/model/testtask/getprojecttasks.php new file mode 100644 index 0000000000..f712177ff5 --- /dev/null +++ b/test/model/testtask/getprojecttasks.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +getProjectTasks(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('testtask'); + +$project11Tasks = $tester->testtask->getProjectTasks(11); +$project20Tasks = $tester->testtask->getProjectTasks(20); +$project100Tasks = $tester->testtask->getProjectTasks(100); + +r(count($project11Tasks)) && p() && e('1'); // 查看项目11下的所有测试单数量 +r(count($project20Tasks)) && p() && e('1'); // 查看项目20下的所有测试单数量 +r(count($project100Tasks)) && p() && e('0'); // 查看项目100下的所有测试单数量 +r($project11Tasks) && p('1:name,type,status,begin,end') && e('测试单1,,wait,2022-04-08,2022-04-15'); // 查看项目11下的测试单1的详细信息 +r($project20Tasks) && p('10:name,type,status,begin,end') && e('测试单10,,doing,2022-04-08,2022-04-15'); // 查看项目20下的所有测试单10的详细信息 diff --git a/test/model/testtask/getrelatedtesttasks.php b/test/model/testtask/getrelatedtesttasks.php new file mode 100644 index 0000000000..c7eb77d9fe --- /dev/null +++ b/test/model/testtask/getrelatedtesttasks.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getRelatedTestTasks(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getRelatedTestTasksTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getresults.php b/test/model/testtask/getresults.php new file mode 100644 index 0000000000..c94bb37b9d --- /dev/null +++ b/test/model/testtask/getresults.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getResults(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getResultsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getrunbyid.php b/test/model/testtask/getrunbyid.php new file mode 100644 index 0000000000..8c0a618b55 --- /dev/null +++ b/test/model/testtask/getrunbyid.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getRunById(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getRunByIdTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getruns.php b/test/model/testtask/getruns.php new file mode 100644 index 0000000000..fd2c2f5ebc --- /dev/null +++ b/test/model/testtask/getruns.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getRuns(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getRunsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/gettaskcases.php b/test/model/testtask/gettaskcases.php new file mode 100644 index 0000000000..5bfc555b8c --- /dev/null +++ b/test/model/testtask/gettaskcases.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getTaskCases(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getTaskCasesTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/gettoandcclist.php b/test/model/testtask/gettoandcclist.php new file mode 100644 index 0000000000..83f0d44ce5 --- /dev/null +++ b/test/model/testtask/gettoandcclist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getToAndCcList(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getToAndCcListTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getuserruns.php b/test/model/testtask/getuserruns.php new file mode 100644 index 0000000000..fa13907f6e --- /dev/null +++ b/test/model/testtask/getuserruns.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getUserRuns(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getUserRunsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/getusertesttaskpairs.php b/test/model/testtask/getusertesttaskpairs.php new file mode 100644 index 0000000000..0eba1ec5f3 --- /dev/null +++ b/test/model/testtask/getusertesttaskpairs.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getUserTestTaskPairs(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->getUserTestTaskPairsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/importunitresult.php b/test/model/testtask/importunitresult.php new file mode 100644 index 0000000000..1bdf1f153c --- /dev/null +++ b/test/model/testtask/importunitresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +importUnitResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->importUnitResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/linkcase.php b/test/model/testtask/linkcase.php new file mode 100644 index 0000000000..945753da2c --- /dev/null +++ b/test/model/testtask/linkcase.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +linkCase(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->linkCaseTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/mergechartoption.php b/test/model/testtask/mergechartoption.php new file mode 100644 index 0000000000..ac81f6b450 --- /dev/null +++ b/test/model/testtask/mergechartoption.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +mergeChartOption(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->mergeChartOptionTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/parsecppxmlresult.php b/test/model/testtask/parsecppxmlresult.php new file mode 100644 index 0000000000..32f93a51bb --- /dev/null +++ b/test/model/testtask/parsecppxmlresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +parseCppXMLResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->parseCppXMLResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/parsexmlresult.php b/test/model/testtask/parsexmlresult.php new file mode 100644 index 0000000000..152284d716 --- /dev/null +++ b/test/model/testtask/parsexmlresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +parseXMLResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->parseXMLResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/parseztffuncresult.php b/test/model/testtask/parseztffuncresult.php new file mode 100644 index 0000000000..4b342e240d --- /dev/null +++ b/test/model/testtask/parseztffuncresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +parseZTFFuncResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->parseZTFFuncResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/parseztfunitresult.php b/test/model/testtask/parseztfunitresult.php new file mode 100644 index 0000000000..7b46b6ea48 --- /dev/null +++ b/test/model/testtask/parseztfunitresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +parseZTFUnitResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->parseZTFUnitResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/printcell.php b/test/model/testtask/printcell.php new file mode 100644 index 0000000000..8cebbe25cd --- /dev/null +++ b/test/model/testtask/printcell.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +printCell(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->printCellTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/processautoresult.php b/test/model/testtask/processautoresult.php new file mode 100644 index 0000000000..b0e87cc8e2 --- /dev/null +++ b/test/model/testtask/processautoresult.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +processAutoResult(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->processAutoResultTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/start.php b/test/model/testtask/start.php new file mode 100644 index 0000000000..7f4173178c --- /dev/null +++ b/test/model/testtask/start.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +start(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->startTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testtask/update.php b/test/model/testtask/update.php new file mode 100644 index 0000000000..089ba79348 --- /dev/null +++ b/test/model/testtask/update.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$testtask = new testtaskTest(); + +r($testtask->updateTest()) && p() && e(); \ No newline at end of file From c61209f40a581b6c1c34126d3ae3dac07f6d24aa Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 8 Apr 2022 06:24:00 +0000 Subject: [PATCH 2/7] * Fix bug#20630 --- lib/scm/gitlab.class.php | 14 +++++++++----- module/gitlab/model.php | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 1d702b267b..a94bfdc9e8 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -66,7 +66,7 @@ class gitlab } else { - $commits = $this->getCommitsByPath($file->path); + $commits = $this->getCommitsByPath($file->path, '', '', 1); if(empty($commits)) continue; $commit = $commits[0]; @@ -108,7 +108,7 @@ class gitlab $file = $this->fetch($api, $param); if(!isset($file->file_name)) return false; - $commits = $this->getCommitsByPath($path); + $commits = $this->getCommitsByPath($path, '', '', 1); $file->revision = $file->commit_id; $file->size = $this->formatBytes($file->size); @@ -636,10 +636,13 @@ class gitlab * Get commits by path. * * @param string $path + * @param string $fromRevision + * @param string $toRevision + * @param int $perPage * @access public * @return array */ - public function getCommitsByPath($path, $fromRevision = '', $toRevision = '') + public function getCommitsByPath($path, $fromRevision = '', $toRevision = '', $perPage = 0) { $path = ltrim($path, DIRECTORY_SEPARATOR); $api = "commits"; @@ -662,10 +665,11 @@ class gitlab { $since = $fromDate; } - if($since) $param->since = $since; if($until) $param->until = $until; + if($perPage) $param->per_page = $perPage; + return $this->fetch($api, $param); } @@ -742,7 +746,7 @@ class gitlab { $params = (array) $params; $params['private_token'] = $this->token; - $params['per_page'] = 100; + $params['per_page'] = isset($params['per_page']) ? $params['per_page'] : 100; $api = ltrim($api, '/'); $api = $this->root . $api . '?' . http_build_query($params); diff --git a/module/gitlab/model.php b/module/gitlab/model.php index ae76ba33bb..54ed60e29a 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -492,6 +492,7 @@ class gitlabModel extends model { /* GitLab API '/users' can only return 20 users per page in default, so we use a loop to fetch all users. */ $page = 1; + $perPage = 100; $response = array(); $apiRoot = $this->getApiRoot($gitlabID); @@ -503,12 +504,14 @@ class gitlabModel extends model while(true) { /* Also use `per_page=20` to fetch users in API. Fetch active users only. */ - $url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page=20&active=true"; - $result = json_decode(commonModel::http($url)); + $url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page={$perPage}&active=true"; + $httpData = commonModel::httpWithHeader($url); + $result = json_decode($httpData['body']); if(!empty($result)) { $response = array_merge($response, $result); $page += 1; + if($httpData['header']['X-Page'] == $httpData['header']['X-Total-Pages']) break; } else { From a1021a3a7437279e8c431f43b4289c3f456d0611 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 8 Apr 2022 15:02:08 +0800 Subject: [PATCH 3/7] * Fix bug#19709. --- module/build/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/build/model.php b/module/build/model.php index 5470d7266f..323ae85c58 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -202,6 +202,7 @@ class buildModel extends model $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD) ->where('id')->in($buildIdList) ->beginIF($objectType === 'execution')->andWhere('execution')->eq($objectID)->fi() + ->beginIF($objectType === 'project')->andWhere('project')->eq($objectID)->fi() ->fetchPairs(); } From 26de46de0aa54f8273f8376fadfb3b7fc7494815 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 8 Apr 2022 07:33:19 +0000 Subject: [PATCH 4/7] * Fix bug #20812. --- module/story/lang/en.php | 1 + module/story/lang/zh-cn.php | 1 + module/story/model.php | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 78ff05105a..a1230ac20a 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = 'Estimate value must be number.'; $lang->story->estimateMustBePlus = 'Estimated value cannot be negative'; $lang->story->confirmChangeBranch = $lang->SRCommon . ' %s is linked to the plan of its linked branch. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan of its linked branch. Do you want to continue edit ' . $lang->SRCommon . '?'; $lang->story->confirmChangePlan = $lang->SRCommon . ' %s is linked to the branch of its plan. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan. Do you want to continue edit branch ?'; +$lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist'; $lang->story->form = new stdclass(); $lang->story->form->area = 'Scope'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index ff0751f10c..e0303c441a 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = '估算值必须是数字'; $lang->story->estimateMustBePlus = '估算值不能是负数'; $lang->story->confirmChangeBranch = $lang->SRCommon . '%s已关联在之前所属分支的计划中,调整分支后,' . $lang->SRCommon . '将从之前所属分支的计划中移除,请确认是否继续修改上述' . $lang->SRCommon . '的分支。'; $lang->story->confirmChangePlan = $lang->SRCommon . '%s已关联在之前计划的所属分支中,调整分支后,' . $lang->SRCommon . '将会从计划中移除,请确认是否继续修改计划的所属分支。'; +$lang->story->errorDuplicateStory = $lang->SRCommon . '%s不存在'; $lang->story->form = new stdclass(); $lang->story->form->area = "该{$lang->SRCommon}所属范围"; diff --git a/module/story/model.php b/module/story/model.php index d5eedc2706..0663530312 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1553,6 +1553,16 @@ class storyModel extends model ->removeIF($this->post->closedReason != 'subdivided', 'childStories') ->get(); + if(!empty($story->duplicateStory)) + { + $duplicateStoryID = $this->dao->select('id')->from(TABLE_STORY)->where('id')->eq($story->duplicateStory)->fetch(); + if(empty($duplicateStoryID)) + { + dao::$errors[] = sprintf($this->lang->story->errorDuplicateStory, $story->duplicateStory); + return false; + } + } + $this->lang->story->comment = $this->lang->comment; $this->dao->update(TABLE_STORY)->data($story, 'comment') ->autoCheck() From 177b9adbfad5ae18b364c9861a6f59c6199cc057 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Fri, 8 Apr 2022 16:03:03 +0800 Subject: [PATCH 5/7] * Fix api format data bug. --- framework/api/entry.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 6ae1237f45..2d93b300d9 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -524,7 +524,7 @@ class baseEntry /* Format value. */ if(!$isArray) { - $object->$key = $this->cast($object->$key, $type); + $object->$key = $this->cast(trim($object->$key, ','), $type); continue; } From bd2a51defe8b5b1cf9af55070aac4c422bf7f24e Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Mon, 11 Apr 2022 09:13:11 +0800 Subject: [PATCH 6/7] update build data --- test/data/build.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/data/build.yaml b/test/data/build.yaml index ef47edb2ff..22ec785fa2 100644 --- a/test/data/build.yaml +++ b/test/data/build.yaml @@ -51,10 +51,22 @@ fields: format: "YYYY-MM-DD" - field: stories - range: '' + fields: + - field: story1 + range: 2-400:4 + prefix: "" + postfix: "," + - field: story2 + range: 4-400:4 - field: bugs - range: ' ' + fields: + - field: bug1 + range: 1-300:3 + prefix: "" + postfix: "," + - field: bug2 + range: 2-400:3 - field: builder range: 1-8 From a8674ddc91dcc864f9321d12599b514d2022bce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Mon, 11 Apr 2022 13:51:13 +0800 Subject: [PATCH 7/7] * Add testtask test. --- module/testtask/model.php | 1 - test/model/testtask/getalllinkablecases.php | 6 +++--- test/model/testtask/getbuginfo.php | 14 ++++++++++++-- .../testtask/getdataoftesttaskpermodule.php | 11 +++++++++-- .../testtask/getdataoftesttaskperrunner.php | 11 +++++++++-- .../getdataoftesttaskperrunresult.php | 14 +++++++++++--- .../testtask/getdataoftesttaskpertype.php | 17 +++++++++++++++-- test/model/testtask/getlinkablecasesbybug.php | 14 ++++++++++++-- .../testtask/getlinkablecasesbystory.php | 15 ++++++++++++--- .../testtask/getlinkablecasesbysuite.php | 16 ++++++++++++++-- .../testtask/getlinkablecasesbytesttask.php | 19 +++++++++++++++++-- test/model/testtask/getrelatedtesttasks.php | 14 +++++++++++--- 12 files changed, 125 insertions(+), 27 deletions(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index 052fe72036..76c13112a9 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -355,7 +355,6 @@ class testtaskModel extends model */ public function getAllLinkableCases($task, $query, $linkedCases, $pager) { - a($query); return $this->dao->select('*')->from(TABLE_CASE)->where($query) ->andWhere('id')->notIN($linkedCases) ->andWhere('status')->ne('wait') diff --git a/test/model/testtask/getalllinkablecases.php b/test/model/testtask/getalllinkablecases.php index d5cb3d7524..d497fe4d0f 100644 --- a/test/model/testtask/getalllinkablecases.php +++ b/test/model/testtask/getalllinkablecases.php @@ -15,9 +15,9 @@ global $tester; $tester->loadModel('testtask'); $tester->app->loadClass('pager', $static = true); -$task1 = $tester->testtask->getById(1); -$task2 = $tester->testtask->getById(2); -$pager = new pager(0, 10, 1); +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); $cases1 = $tester->testtask->getAllLinkableCases($task1, '1 = 1', '', $pager); $cases2 = $tester->testtask->getAllLinkableCases($task2, '1 = 1', '', null); diff --git a/test/model/testtask/getbuginfo.php b/test/model/testtask/getbuginfo.php index 403a68f025..59e2335d35 100644 --- a/test/model/testtask/getbuginfo.php +++ b/test/model/testtask/getbuginfo.php @@ -12,6 +12,16 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); -r($testtask->getBugInfoTest()) && p() && e(); \ No newline at end of file +$task1 = $tester->testtask->getBugInfo(1, 1); +$task2 = $tester->testtask->getBugInfo(2, 2); + +r(count($task1)) && p() && e('8'); // 查看根据测试单的ID获取到的数据数量 +r($task1['bugSeverityGroups']) && p('1:name,value') && e('1,1'); // 查看根据测试单的ID获取到的数据数量 +r($task1['bugStatusGroups']) && p('active:name,value') && e('激活,1'); // 查看根据测试单的ID获取到的数据数量 + +r(count($task2)) && p() && e('8'); // 查看根据测试单的ID获取到的数据数量 +r($task2['bugSeverityGroups']) && p('2:name,value') && e('2,1'); // 查看根据测试单的ID获取到的数据数量 +r($task2['bugOpenedByGroups']) && p('admin:name,value') && e('admin,1'); // 查看根据测试单的ID获取到的数据数量 diff --git a/test/model/testtask/getdataoftesttaskpermodule.php b/test/model/testtask/getdataoftesttaskpermodule.php index 3d1d01437e..0afd473dc8 100644 --- a/test/model/testtask/getdataoftesttaskpermodule.php +++ b/test/model/testtask/getdataoftesttaskpermodule.php @@ -12,6 +12,13 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); -r($testtask->getDataOfTestTaskPerModuleTest()) && p() && e(); \ No newline at end of file +$result0 = $tester->testtask->getDataOfTestTaskPerModule(0); +$result1 = $tester->testtask->getDataOfTestTaskPerModule(1); +$result2 = $tester->testtask->getDataOfTestTaskPerModule(2); + +r($result0) && p() && e('0'); // 获取测试单0的模块分组 +r($result1[0]) && p('name,value') && e('/,4'); // 获取测试单1模块分组,查看各个模块的数量 +r($result2[0]) && p('name,value') && e('/,4'); // 获取测试单2模块分组,查看各个模块的数量 diff --git a/test/model/testtask/getdataoftesttaskperrunner.php b/test/model/testtask/getdataoftesttaskperrunner.php index f44ebce186..afb2a9484c 100644 --- a/test/model/testtask/getdataoftesttaskperrunner.php +++ b/test/model/testtask/getdataoftesttaskperrunner.php @@ -12,6 +12,13 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); -r($testtask->getDataOfTestTaskPerRunnerTest()) && p() && e(); \ No newline at end of file +$result0 = $tester->testtask->getDataOfTestTaskPerRunner(0); +$result1 = $tester->testtask->getDataOfTestTaskPerRunner(1); +$result2 = $tester->testtask->getDataOfTestTaskPerRunner(2); + +r($result0) && p() && e('0'); // 获取测试单0的执行人分组 +r(current($result1)) && p('name,value') && e('未执行,4'); // 获取测试单1执行人分组,查看各个执行人的执行数量 +r(current($result2)) && p('name,value') && e('未执行,4'); // 获取测试单2执行人分组,查看各个执行人的执行数量 diff --git a/test/model/testtask/getdataoftesttaskperrunresult.php b/test/model/testtask/getdataoftesttaskperrunresult.php index fdc315b5cd..f950c7a5a2 100644 --- a/test/model/testtask/getdataoftesttaskperrunresult.php +++ b/test/model/testtask/getdataoftesttaskperrunresult.php @@ -1,7 +1,6 @@ #!/usr/bin/env php loadModel('testtask'); -r($testtask->getDataOfTestTaskPerRunResultTest()) && p() && e(); \ No newline at end of file +$result0 = $tester->testtask->getDataOfTestTaskPerRunResult(0); +$result1 = $tester->testtask->getDataOfTestTaskPerRunResult(1); +$result2 = $tester->testtask->getDataOfTestTaskPerRunResult(2); + +r($result0) && p() && e('0'); // 获取测试单0的执行结果 +r($result1) && p('pass:value') && e('2'); // 获取测试单1的成功执行结果 +r($result1) && p('fail:value') && e('2'); // 获取测试单1的失败执行结果 +r($result2) && p('pass:value') && e('2'); // 获取测试单2的成功执行结果 +r($result2) && p('fail:value') && e('2'); // 获取测试单2的失败执行结果 diff --git a/test/model/testtask/getdataoftesttaskpertype.php b/test/model/testtask/getdataoftesttaskpertype.php index bea6f554d2..d2f5e37216 100644 --- a/test/model/testtask/getdataoftesttaskpertype.php +++ b/test/model/testtask/getdataoftesttaskpertype.php @@ -12,6 +12,19 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); -r($testtask->getDataOfTestTaskPerTypeTest()) && p() && e(); \ No newline at end of file +$result0 = $tester->testtask->getDataOfTestTaskPerType(0); +$result1 = $tester->testtask->getDataOfTestTaskPerType(1); +$result2 = $tester->testtask->getDataOfTestTaskPerType(2); + +r($result0) && p() && e('0'); // 获取测试单0的类型分组 +r($result1) && p('config:value') && e('1'); // 获取测试单1的config类型数量 +r($result1) && p('feature:value') && e('1'); // 获取测试单1的feature类型数量 +r($result1) && p('install:value') && e('1'); // 获取测试单1的install类型数量 +r($result1) && p('performance:value') && e('1'); // 获取测试单1的performance类型数量 +r($result2) && p('other:value') && e('1'); // 获取测试单2的other类型数量 +r($result2) && p('security:value') && e('1'); // 获取测试单2的security类型数量 +r($result2) && p('feature:value') && e('1'); // 获取测试单2的feature类型数量 +r($result2) && p('interface:value') && e('1'); // 获取测试单2的interface类型数量 diff --git a/test/model/testtask/getlinkablecasesbybug.php b/test/model/testtask/getlinkablecasesbybug.php index 72888d689d..621150268a 100644 --- a/test/model/testtask/getlinkablecasesbybug.php +++ b/test/model/testtask/getlinkablecasesbybug.php @@ -12,6 +12,16 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); +$tester->app->loadClass('pager', $static = true); -r($testtask->getLinkableCasesByBugTest()) && p() && e(); \ No newline at end of file +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); + +$cases1 = $tester->testtask->getLinkableCasesByBug(1, $task1, '1 = 1', '', $pager); +$cases2 = $tester->testtask->getLinkableCasesByBug(2, $task2, '1 = 1', '', $pager); + +r(count($cases1)) && p() && e('0'); // 通过测试单1关联的版本下的Bug,获取可关联到测试单1的用例数量 +r(count($cases2)) && p() && e('0'); // 通过测试单2关联的版本下的Bug,获取可关联到测试单2的用例数量 diff --git a/test/model/testtask/getlinkablecasesbystory.php b/test/model/testtask/getlinkablecasesbystory.php index 98573bf718..6ff58fcffb 100644 --- a/test/model/testtask/getlinkablecasesbystory.php +++ b/test/model/testtask/getlinkablecasesbystory.php @@ -1,7 +1,6 @@ #!/usr/bin/env php loadModel('testtask'); +$tester->app->loadClass('pager', $static = true); -r($testtask->getLinkableCasesByStoryTest()) && p() && e(); \ No newline at end of file +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); + +$cases1 = $tester->testtask->getLinkableCasesByStory(1, $task1, '1 = 1', '', $pager); +$cases2 = $tester->testtask->getLinkableCasesByStory(2, $task2, '1 = 1', '', $pager); + +r(count($cases1)) && p() && e('0'); // 通过测试单1关联的版本下的需求,获取可关联到测试单1的用例数量 +r(count($cases2)) && p() && e('0'); // 通过测试单2关联的版本下的需求,获取可关联到测试单2的用例数量 diff --git a/test/model/testtask/getlinkablecasesbysuite.php b/test/model/testtask/getlinkablecasesbysuite.php index 372ac2d004..7090ae1767 100644 --- a/test/model/testtask/getlinkablecasesbysuite.php +++ b/test/model/testtask/getlinkablecasesbysuite.php @@ -12,6 +12,18 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); +$tester->app->loadClass('pager', $static = true); -r($testtask->getLinkableCasesBySuiteTest()) && p() && e(); \ No newline at end of file +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); + +$cases1 = $tester->testtask->getLinkableCasesBySuite(1, $task1, '1 = 1', 1, '', $pager); +$cases2 = $tester->testtask->getLinkableCasesBySuite(2, $task2, '1 = 1', 3, '', $pager); + +r(count($cases1)) && p() && e('1'); // 根据测试套件1获取测试单1可关联的用例数量 +r(count($cases2)) && p() && e('1'); // 根据测试套件2获取测试单2可关联的用例数量 +r($cases1) && p('0:id,title,status,type') && e('2,这个是测试用例2,normal,performance'); // 根据测试套件1获取测试单1可关联的用例详情 +r($cases2) && p('0:id,title,status,type') && e('6,这个是测试用例6,normal,interface'); // 根据测试套件2获取测试单2可关联的用例详情 diff --git a/test/model/testtask/getlinkablecasesbytesttask.php b/test/model/testtask/getlinkablecasesbytesttask.php index 5e38841f50..00b35fb497 100644 --- a/test/model/testtask/getlinkablecasesbytesttask.php +++ b/test/model/testtask/getlinkablecasesbytesttask.php @@ -12,6 +12,21 @@ pid=1 */ -$testtask = new testtaskTest(); +global $tester; +$tester->loadModel('testtask'); +$tester->app->loadClass('pager', $static = true); -r($testtask->getLinkableCasesByTestTaskTest()) && p() && e(); \ No newline at end of file +$task1 = $tester->testtask->getById(1); +$task2 = $tester->testtask->getById(2); +$pager = new pager(0, 10, 1); + +$cases1 = $tester->testtask->getLinkableCasesByTestTask(1, array(2), '1 = 1', $pager); +$cases2 = $tester->testtask->getLinkableCasesByTestTask(2, '', '1 = 1', $pager); +$cases3 = $tester->testtask->getLinkableCasesByTestTask(3, '', '1 = 1', $pager); + +r(count($cases1)) && p() && e('2'); // 直接获取测试单1可关联的用例数量,排除掉ID为2的用例,查看数量 +r(count($cases2)) && p() && e('3'); // 直接获取测试单2可关联的用例数量,查看数量 +r(count($cases3)) && p() && e('3'); // 直接获取测试单3可关联的用例数量,查看数量 +r($cases1) && p('0:id,title,type,stage') && e('3,这个是测试用例3,config,intergrate'); // 直接获取测试单1可关联的用例数量,排除掉ID为2的用例,查看获取到的第一个用例的详情 +r($cases2) && p('0:id,title,type,stage') && e('6,这个是测试用例6,interface,bvt'); // 直接获取测试单2可关联的用例数量,查看获取到的第一个用例的详情 +r($cases3) && p('0:id,title,type,stage') && e('10,这个是测试用例10,config,system'); // 直接获取测试单3可关联的用例数量,查看获取到的第一个用例的详情 diff --git a/test/model/testtask/getrelatedtesttasks.php b/test/model/testtask/getrelatedtesttasks.php index c7eb77d9fe..171a23b1f4 100644 --- a/test/model/testtask/getrelatedtesttasks.php +++ b/test/model/testtask/getrelatedtesttasks.php @@ -1,7 +1,6 @@ #!/usr/bin/env php loadModel('testtask'); -r($testtask->getRelatedTestTasksTest()) && p() && e(); \ No newline at end of file +$tasks1 = $tester->testtask->getRelatedTestTasks(1, 1); +$tasks2 = $tester->testtask->getRelatedTestTasks(1, 0); +$tasks3 = $tester->testtask->getRelatedTestTasks(2, 0); + +r(count($tasks1)) && p() && e('0'); //查看产品1下相关的测试单,排除掉测试单1,查看数量 +r(count($tasks2)) && p() && e('1'); //查看产品1下相关的测试单,不排除任何测试单,查看数量 +r(count($tasks3)) && p() && e('1'); //查看产品2下相关的测试单,不排除任何测试单,查看数量 +r($tasks2) && p('1') && e('测试单1'); //查看产品2下相关的测试单,不排除任何测试单,查看数量 +r($tasks3) && p('2') && e('测试单2'); //查看产品2下相关的测试单,不排除任何测试单,查看数量