diff --git a/test/class/testsuite.class.php b/test/class/testsuite.class.php new file mode 100644 index 0000000000..9c92031e1a --- /dev/null +++ b/test/class/testsuite.class.php @@ -0,0 +1,218 @@ +objectModel = $tester->loadModel('testsuite'); + } + + public function selectTest($products, $productID, $currentModule, $currentMethod, $extra = '') + { + $objects = $this->objectModel->select($products, $productID, $currentModule, $currentMethod, $extra); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test create a test suite. + * + * @param int $productID + * @param string $name + * @param string $type + * @access public + * @return array|int + */ + public function createTest($productID, $name, $type) + { + $_POST['name'] = $name; + $_POST['desc'] = ''; + $_POST['type'] = $type; + $_POST['uid'] = '62538b850bb9d'; + + $objects = $this->objectModel->create($productID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get test suites of a product. + * + * @param int $productID + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getSuitesTest($productID, $orderBy = 'id_desc', $pager = null) + { + $objects = $this->objectModel->getSuites($productID, $orderBy, $pager); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get unit suite. + * + * @param int $productID + * @param string $orderBy + * @access public + * @return array + */ + public function getUnitSuitesTest($productID, $orderBy = 'id_desc') + { + $objects = $this->objectModel->getUnitSuites($productID, $orderBy); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get test suite info by id. + * + * @param int $suiteID + * @param bool $setImgSize + * @access public + * @return object + */ + public function getByIdTest($suiteID, $setImgSize = false) + { + $objects = $this->objectModel->getById($suiteID, $setImgSize); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test update a test suite. + * + * @param int $suiteID + * @access public + * @return bool|array + */ + public function updateTest($suiteID, $name, $type) + { + $_POST['name'] = $name; + $_POST['desc'] = ''; + $_POST['type'] = $type; + $_POST['uid'] = '62538b850bb9d'; + + $objects = $this->objectModel->update($suiteID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test link cases. + * + * @param int $suiteID + * @param array $cases + * @access public + * @return void + */ + public function linkCaseTest($suiteID, $cases) + { + $_POST['cases'] = $cases; + foreach($cases as $case) + { + $_POST['versions'][$case] = 1; + } + + $this->objectModel->linkCase($suiteID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_SUITECASE)->where('suite')->eq($suiteID)->andWhere('`case`')->in($cases)->fetchAll(); + + return $objects; + } + + /** + * Test get linked cases for suite. + * + * @param int $suiteID + * @param string $orderBy + * @param object $pager + * @param bool $append + * @access public + * @return array + */ + public function getLinkedCasesTest($suiteID, $orderBy = 'id_desc', $pager = null, $append = true) + { + $objects = $this->objectModel->getLinkedCases($suiteID, $orderBy, $pager, $append); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get unlinked cases for suite. + * + * @param int $suiteID + * @param int $param + * @param object $pager + * @access public + * @return array + */ + public function getUnlinkedCasesTest($suiteID, $param = 0, $pager = null) + { + + $suite = $this->objectModel->getById($suiteID); + $objects = $this->objectModel->getUnlinkedCases($suite, $param, $pager); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test delete suite and library. + * + * @param int $suiteID + * @param string $table + * @access public + * @return int + */ + public function deleteTest($suiteID, $table = '') + { + $objects = $this->objectModel->delete($suiteID, $table); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get not imported cases. + * + * @param int $productID + * @param int $libID + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getNotImportedCasesTest($productID, $libID, $orderBy = 'id_desc', $pager = null, $browseType = '', $queryID = 0) + { + $objects = $this->objectModel->getNotImportedCases($productID, $libID, $orderBy, $pager, $browseType, $queryID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/testsuite/create.php b/test/model/testsuite/create.php new file mode 100755 index 0000000000..707e7f9a46 --- /dev/null +++ b/test/model/testsuite/create.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +测试productID为1,name正常存在,type为private >> 202 +测试productID为1,name为空,type为private >> 『名称』不能为空。 +测试productID为1,name正常存在,type为public >> 203 +测试productID为1,name为空,type为public >> 『名称』不能为空。 +测试productID为1,name正常存在,type为空 >> 204 +测试productID为1,name为空,type为空 >> 『名称』不能为空。 +测试productID为0,name正常存在,type为private >> 205 +测试productID为0,name为空,type为private >> 『名称』不能为空。 +测试productID为0,name正常存在,type为public >> 206 +测试productID为0,name为空,type为public >> 『名称』不能为空。 +测试productID为0,name正常存在,type为空 >> 207 +测试productID为0,name为空,type为空 >> 『名称』不能为空。 + +*/ +$productID = array(1, 0); +$name = array('这是测试套件名称1000', ''); +$type = array('private', 'public', ''); + +$testsuite = new testsuiteTest(); + +r($testsuite->createTest($productID[0], $name[0], $type[0])) && p() && e('202'); //测试productID为1,name正常存在,type为private +r($testsuite->createTest($productID[0], $name[1], $type[0])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为private +r($testsuite->createTest($productID[0], $name[0], $type[1])) && p() && e('203'); //测试productID为1,name正常存在,type为public +r($testsuite->createTest($productID[0], $name[1], $type[1])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为public +r($testsuite->createTest($productID[0], $name[0], $type[2])) && p() && e('204'); //测试productID为1,name正常存在,type为空 +r($testsuite->createTest($productID[0], $name[1], $type[2])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为空 +r($testsuite->createTest($productID[1], $name[0], $type[0])) && p() && e('205'); //测试productID为0,name正常存在,type为private +r($testsuite->createTest($productID[1], $name[1], $type[0])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为private +r($testsuite->createTest($productID[1], $name[0], $type[1])) && p() && e('206'); //测试productID为0,name正常存在,type为public +r($testsuite->createTest($productID[1], $name[1], $type[1])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为public +r($testsuite->createTest($productID[1], $name[0], $type[2])) && p() && e('207'); //测试productID为0,name正常存在,type为空 +r($testsuite->createTest($productID[1], $name[1], $type[2])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为空 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/testsuite/delete.php b/test/model/testsuite/delete.php new file mode 100755 index 0000000000..b07e584faa --- /dev/null +++ b/test/model/testsuite/delete.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +delete(); +cid=1 +pid=1 + +测试suiteID值为1 >> 1 +测试suiteID值为1000 >> 1 +测试suiteID值为0 >> 1 + +*/ +$suiteID = array(1, 1000, 0); + +$testsuite = new testsuiteTest(); + +r($testsuite->deleteTest($suiteID[0])) && p() && e('1'); //测试suiteID值为1 +r($testsuite->deleteTest($suiteID[1])) && p() && e('1'); //测试suiteID值为1000 +r($testsuite->deleteTest($suiteID[2])) && p() && e('1'); //测试suiteID值为0 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/testsuite/getbyid.php b/test/model/testsuite/getbyid.php new file mode 100755 index 0000000000..8dd2d38ec2 --- /dev/null +++ b/test/model/testsuite/getbyid.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getById(); +cid=1 +pid=1 + +测试suiteID值为0,setImgSize值为false >> 0 +测试suiteID值为1000,setImgSize值为false >> 0 +测试suiteID值为1,setImgSize值为true >> 1,这是测试套件的描述1 +测试suiteID值为1,setImgSize值为false >> 1,这是测试套件的描述1 + +*/ +$suiteID = array(0, 1, 1000); +$setImgSize = array(true, false); + +$testsuite = new testsuiteTest(); + +r($testsuite->getByIdTest($suiteID[0], $setImgSize[1])) && p() && e('0'); //测试suiteID值为0,setImgSize值为false +r($testsuite->getByIdTest($suiteID[2], $setImgSize[1])) && p() && e('0'); //测试suiteID值为1000,setImgSize值为false +r($testsuite->getByIdTest($suiteID[1], $setImgSize[0])) && p('id,desc') && e('1,这是测试套件的描述1'); //测试suiteID值为1,setImgSize值为true +r($testsuite->getByIdTest($suiteID[1], $setImgSize[1])) && p('id,desc') && e('1,这是测试套件的描述1'); //测试suiteID值为1,setImgSize值为false \ No newline at end of file diff --git a/test/model/testsuite/getlinkedcases.php b/test/model/testsuite/getlinkedcases.php new file mode 100755 index 0000000000..5bdb4c2a87 --- /dev/null +++ b/test/model/testsuite/getlinkedcases.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +getLinkedCases(); +cid=1 +pid=1 + +测试suiteID值正常存在,orderBy值为id_desc,append值为true >> 2,这个是测试用例2;1,这个是测试用例1 +测试suiteID值正常存在,orderBy值为id_desc,append值为false >> 2,这个是测试用例2;1,这个是测试用例1 +测试suiteID值正常存在,orderBy值为id_asc,append值为true >> 1,这个是测试用例1;2,这个是测试用例2 +测试suiteID值正常存在,orderBy值为id_asc,append值为false >> 1,这个是测试用例1;2,这个是测试用例2 +测试suiteID值正常存在,orderBy值为title_desc,id_desc,append值为true >> 2,这个是测试用例2;1,这个是测试用例1 +测试suiteID值正常存在,orderBy值为title_desc,id_desc,append值为false >> 2,这个是测试用例2;1,这个是测试用例1 +测试suiteID值正常存在,orderBy值为title_asc,id_desc,append值为true >> 1,这个是测试用例1;2,这个是测试用例2 +测试suiteID值正常存在,orderBy值为title_asc,id_desc,append值为false >> 1,这个是测试用例1;2,这个是测试用例2 + +*/ +$suiteID = 1; +$orderBy = array('id_desc', 'id_asc', 'title_desc,id_desc', 'title_asc,id_desc'); +$append = array(true, false); + +$testsuite = new testsuiteTest(); + +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[0], '', $append[0])) && p('2:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值正常存在,orderBy值为id_desc,append值为true +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[0], '', $append[1])) && p('2:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值正常存在,orderBy值为id_desc,append值为false +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[1], '', $append[0])) && p('1:id,title;2:id,title') && e('1,这个是测试用例1;2,这个是测试用例2'); //测试suiteID值正常存在,orderBy值为id_asc,append值为true +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[1], '', $append[1])) && p('1:id,title;2:id,title') && e('1,这个是测试用例1;2,这个是测试用例2'); //测试suiteID值正常存在,orderBy值为id_asc,append值为false +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[2], '', $append[0])) && p('2:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值正常存在,orderBy值为title_desc,id_desc,append值为true +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[2], '', $append[1])) && p('2:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值正常存在,orderBy值为title_desc,id_desc,append值为false +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[3], '', $append[0])) && p('1:id,title;2:id,title') && e('1,这个是测试用例1;2,这个是测试用例2'); //测试suiteID值正常存在,orderBy值为title_asc,id_desc,append值为true +r($testsuite->getLinkedCasesTest($suiteID, $orderBy[3], '', $append[1])) && p('1:id,title;2:id,title') && e('1,这个是测试用例1;2,这个是测试用例2'); //测试suiteID值正常存在,orderBy值为title_asc,id_desc,append值为false \ No newline at end of file diff --git a/test/model/testsuite/getnotimportedcases.php b/test/model/testsuite/getnotimportedcases.php new file mode 100755 index 0000000000..d764117eb4 --- /dev/null +++ b/test/model/testsuite/getnotimportedcases.php @@ -0,0 +1,52 @@ +#!/usr/bin/env php +getNotImportedCases(); +cid=1 +pid=1 + +测试productID值为1,libID值为0,orderBy值为id_desc >> 0 +测试productID值为1,libID值为0,orderBy值为id_asc >> 0 +测试productID值为1,libID值为0,orderBy值为title_desc,id_desc >> 0 +测试productID值为1,libID值为0,orderBy值为title_asc,id_desc >> 0 +测试productID值为0,libID值为0,orderBy值为id_desc >> 0 +测试productID值为0,libID值为0,orderBy值为id_asc >> 0 +测试productID值为0,libID值为0,orderBy值为title_desc,id_desc >> 0 +测试productID值为0,libID值为0,orderBy值为title_asc,id_desc >> 0 +测试productID值为1,libID值为201,orderBy值为id_desc >> 410,用例库用例10;409,用例库用例9 +测试productID值为1,libID值为201,orderBy值为id_asc >> 401,用例库用例1;402,用例库用例2 +测试productID值为1,libID值为201,orderBy值为title_desc,id_desc >> 409,用例库用例9;408,用例库用例8 +测试productID值为1,libID值为201,orderBy值为title_asc,id_desc >> 401,用例库用例1;410,用例库用例10 +测试productID值为0,libID值为201,orderBy值为id_desc >> 410,用例库用例10;409,用例库用例9 +测试productID值为0,libID值为201,orderBy值为id_asc >> 401,用例库用例1;402,用例库用例2 +测试productID值为0,libID值为201,orderBy值为title_desc,id_desc >> 409,用例库用例9;408,用例库用例8 +测试productID值为0,libID值为201,orderBy值为title_asc,id_desc >> 401,用例库用例1;410,用例库用例10 + +*/ +$productID = array(1, 0); +$libID = array(201, 0); +$orderBy = array('id_desc', 'id_asc', 'title_desc,id_desc', 'title_asc,id_desc'); + +$testsuite = new testsuiteTest(); + +r($testsuite->getNotImportedCasesTest($productID[0], $libID[1], $orderBy[0])) && p() && e('0'); //测试productID值为1,libID值为0,orderBy值为id_desc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[1], $orderBy[1])) && p() && e('0'); //测试productID值为1,libID值为0,orderBy值为id_asc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[1], $orderBy[2])) && p() && e('0'); //测试productID值为1,libID值为0,orderBy值为title_desc,id_desc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[1], $orderBy[3])) && p() && e('0'); //测试productID值为1,libID值为0,orderBy值为title_asc,id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[1], $orderBy[0])) && p() && e('0'); //测试productID值为0,libID值为0,orderBy值为id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[1], $orderBy[1])) && p() && e('0'); //测试productID值为0,libID值为0,orderBy值为id_asc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[1], $orderBy[2])) && p() && e('0'); //测试productID值为0,libID值为0,orderBy值为title_desc,id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[1], $orderBy[3])) && p() && e('0'); //测试productID值为0,libID值为0,orderBy值为title_asc,id_desc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[0], $orderBy[0])) && p('410:id,title;409:id,title') && e('410,用例库用例10;409,用例库用例9'); //测试productID值为1,libID值为201,orderBy值为id_desc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[0], $orderBy[1])) && p('401:id,title;402:id,title') && e('401,用例库用例1;402,用例库用例2'); //测试productID值为1,libID值为201,orderBy值为id_asc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[0], $orderBy[2])) && p('409:id,title;408:id,title') && e('409,用例库用例9;408,用例库用例8'); //测试productID值为1,libID值为201,orderBy值为title_desc,id_desc +r($testsuite->getNotImportedCasesTest($productID[0], $libID[0], $orderBy[3])) && p('401:id,title;410:id,title') && e('401,用例库用例1;410,用例库用例10'); //测试productID值为1,libID值为201,orderBy值为title_asc,id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[0], $orderBy[0])) && p('410:id,title;409:id,title') && e('410,用例库用例10;409,用例库用例9'); //测试productID值为0,libID值为201,orderBy值为id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[0], $orderBy[1])) && p('401:id,title;402:id,title') && e('401,用例库用例1;402,用例库用例2'); //测试productID值为0,libID值为201,orderBy值为id_asc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[0], $orderBy[2])) && p('409:id,title;408:id,title') && e('409,用例库用例9;408,用例库用例8'); //测试productID值为0,libID值为201,orderBy值为title_desc,id_desc +r($testsuite->getNotImportedCasesTest($productID[1], $libID[0], $orderBy[3])) && p('401:id,title;410:id,title') && e('401,用例库用例1;410,用例库用例10'); //测试productID值为0,libID值为201,orderBy值为title_asc,id_desc \ No newline at end of file diff --git a/test/model/testsuite/getsuites.php b/test/model/testsuite/getsuites.php new file mode 100755 index 0000000000..3393ada24b --- /dev/null +++ b/test/model/testsuite/getsuites.php @@ -0,0 +1,35 @@ +#!/usr/bin/env php +getSuites(); +cid=1 +pid=1 + +测试productID值为1,orderBy为id_desc >> 这是测试套件名称2;这是测试套件名称1 +测试productID值为1,orderBy为id_asc >> 这是测试套件名称1;这是测试套件名称2 +测试productID值为1,orderBy为name_desc,id_desc >> 这是测试套件名称2;这是测试套件名称1 +测试productID值为1,orderBy为name_asc,id_desc >> 这是测试套件名称1;这是测试套件名称2 +测试productID值为1,orderBy为id_desc >> 0 +测试productID值为1,orderBy为id_asc >> 0 +测试productID值为1,orderBy为name_desc,id_desc >> 0 +测试productID值为1,orderBy为name_asc,id_desc >> 0 + +*/ +$productID = array(1, 0); +$orderBy = array('id_desc', 'id_asc', 'name_desc,id_desc', 'name_asc,id_desc'); + +$testsuite = new testsuiteTest(); + +r($testsuite->getSuitesTest($productID[0], $orderBy[0])) && p('2:name;1:name') && e('这是测试套件名称2;这是测试套件名称1'); //测试productID值为1,orderBy为id_desc +r($testsuite->getSuitesTest($productID[0], $orderBy[1])) && p('1:name;2:name') && e('这是测试套件名称1;这是测试套件名称2'); //测试productID值为1,orderBy为id_asc +r($testsuite->getSuitesTest($productID[0], $orderBy[2])) && p('2:name;1:name') && e('这是测试套件名称2;这是测试套件名称1'); //测试productID值为1,orderBy为name_desc,id_desc +r($testsuite->getSuitesTest($productID[0], $orderBy[3])) && p('1:name;2:name') && e('这是测试套件名称1;这是测试套件名称2'); //测试productID值为1,orderBy为name_asc,id_desc +r($testsuite->getSuitesTest($productID[1], $orderBy[0])) && p() && e('0'); //测试productID值为1,orderBy为id_desc +r($testsuite->getSuitesTest($productID[1], $orderBy[1])) && p() && e('0'); //测试productID值为1,orderBy为id_asc +r($testsuite->getSuitesTest($productID[1], $orderBy[2])) && p() && e('0'); //测试productID值为1,orderBy为name_desc,id_desc +r($testsuite->getSuitesTest($productID[1], $orderBy[3])) && p() && e('0'); //测试productID值为1,orderBy为name_asc,id_desc \ No newline at end of file diff --git a/test/model/testsuite/getunitsuites.php b/test/model/testsuite/getunitsuites.php new file mode 100755 index 0000000000..a652e9a378 --- /dev/null +++ b/test/model/testsuite/getunitsuites.php @@ -0,0 +1,35 @@ +#!/usr/bin/env php +getUnitSuites(); +cid=1 +pid=1 + +测试productID值为1,orderBy为id_desc >> 0 +测试productID值为1,orderBy为id_asc >> 0 +测试productID值为1,orderBy为name_desc,id_desc >> 0 +测试productID值为1,orderBy为name_asc,id_desc >> 0 +测试productID值为1,orderBy为id_desc >> 0 +测试productID值为1,orderBy为id_asc >> 0 +测试productID值为1,orderBy为name_desc,id_desc >> 0 +测试productID值为1,orderBy为name_asc,id_desc >> 0 + +*/ +$productID = array(1, 0); +$orderBy = array('id_desc', 'id_asc', 'name_desc,id_desc', 'name_asc,id_desc'); + +$testsuite = new testsuiteTest(); + +r($testsuite->getUnitSuitesTest($productID[0], $orderBy[0])) && p() && e('0'); //测试productID值为1,orderBy为id_desc +r($testsuite->getUnitSuitesTest($productID[0], $orderBy[1])) && p() && e('0'); //测试productID值为1,orderBy为id_asc +r($testsuite->getUnitSuitesTest($productID[0], $orderBy[2])) && p() && e('0'); //测试productID值为1,orderBy为name_desc,id_desc +r($testsuite->getUnitSuitesTest($productID[0], $orderBy[3])) && p() && e('0'); //测试productID值为1,orderBy为name_asc,id_desc +r($testsuite->getUnitSuitesTest($productID[1], $orderBy[0])) && p() && e('0'); //测试productID值为1,orderBy为id_desc +r($testsuite->getUnitSuitesTest($productID[1], $orderBy[1])) && p() && e('0'); //测试productID值为1,orderBy为id_asc +r($testsuite->getUnitSuitesTest($productID[1], $orderBy[2])) && p() && e('0'); //测试productID值为1,orderBy为name_desc,id_desc +r($testsuite->getUnitSuitesTest($productID[1], $orderBy[3])) && p() && e('0'); //测试productID值为1,orderBy为name_asc,id_desc \ No newline at end of file diff --git a/test/model/testsuite/getunlinkedcases.php b/test/model/testsuite/getunlinkedcases.php new file mode 100755 index 0000000000..c297a490f3 --- /dev/null +++ b/test/model/testsuite/getunlinkedcases.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getUnlinkedCases(); +cid=1 +pid=1 + +测试suiteID值为1,param值为0 >> 4,这个是测试用例4;3,这个是测试用例3 +测试suiteID值为1,param值为myQueryID >> 4,这个是测试用例4;3,这个是测试用例3 +测试suiteID值为2,param值为0 >> 2,这个是测试用例2;1,这个是测试用例1 +测试suiteID值为2,param值为myQueryID >> 2,这个是测试用例2;1,这个是测试用例1 + +*/ +$suiteID = array(1, 2); +$param = array(0, 'myQueryID'); + +$testsuite = new testsuiteTest(); + +r($testsuite->getUnlinkedCasesTest($suiteID[0], $param[0])) && p('0:id,title;1:id,title') && e('4,这个是测试用例4;3,这个是测试用例3'); //测试suiteID值为1,param值为0 +r($testsuite->getUnlinkedCasesTest($suiteID[0], $param[1])) && p('0:id,title;1:id,title') && e('4,这个是测试用例4;3,这个是测试用例3'); //测试suiteID值为1,param值为myQueryID +r($testsuite->getUnlinkedCasesTest($suiteID[1], $param[0])) && p('0:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值为2,param值为0 +r($testsuite->getUnlinkedCasesTest($suiteID[1], $param[1])) && p('0:id,title;1:id,title') && e('2,这个是测试用例2;1,这个是测试用例1'); //测试suiteID值为2,param值为myQueryID \ No newline at end of file diff --git a/test/model/testsuite/linkcase.php b/test/model/testsuite/linkcase.php new file mode 100755 index 0000000000..26c88e47bb --- /dev/null +++ b/test/model/testsuite/linkcase.php @@ -0,0 +1,38 @@ +#!/usr/bin/env php +linkCase(); +cid=1 +pid=1 + +测试存在的suiteID值为1,cases值为空 >> 0 +测试存在的suiteID值为1,cases值为一个 >> 1,1 +测试存在的suiteID值为1,cases值为多个 >> 1,2;1,3 +测试不存在的suiteID值为1000,cases值为空 >> 0 +测试不存在的suiteID值为1000,cases值为一个 >> 1000,1 +测试不存在的suiteID值为1000,cases值为多个 >> 1000,2;1000,3 +测试不存在的suiteID值为0,cases值为空 >> 0 +测试不存在的suiteID值为0,cases值为一个 >> 0,1 +测试不存在的suiteID值为0,cases值为多个 >> 0,2;0,3 + +*/ +$suiteID = array(1, 1000, 0); +$cases = array(array(), array(1), array(2, 3)); + +$testsuite = new testsuiteTest(); + +r($testsuite->linkCaseTest($suiteID[0], $cases[0])) && p() && e('0'); //测试存在的suiteID值为1,cases值为空 +r($testsuite->linkCaseTest($suiteID[0], $cases[1])) && p('0:suite,case') && e('1,1'); //测试存在的suiteID值为1,cases值为一个 +r($testsuite->linkCaseTest($suiteID[0], $cases[2])) && p('0:suite,case;1:suite,case') && e('1,2;1,3'); //测试存在的suiteID值为1,cases值为多个 +r($testsuite->linkCaseTest($suiteID[1], $cases[0])) && p() && e('0'); //测试不存在的suiteID值为1000,cases值为空 +r($testsuite->linkCaseTest($suiteID[1], $cases[1])) && p('0:suite,case') && e('1000,1'); //测试不存在的suiteID值为1000,cases值为一个 +r($testsuite->linkCaseTest($suiteID[1], $cases[2])) && p('0:suite,case;1:suite,case') && e('1000,2;1000,3'); //测试不存在的suiteID值为1000,cases值为多个 +r($testsuite->linkCaseTest($suiteID[2], $cases[0])) && p() && e('0'); //测试不存在的suiteID值为0,cases值为空 +r($testsuite->linkCaseTest($suiteID[2], $cases[1])) && p('0:suite,case') && e('0,1'); //测试不存在的suiteID值为0,cases值为一个 +r($testsuite->linkCaseTest($suiteID[2], $cases[2])) && p('0:suite,case;1:suite,case') && e('0,2;0,3'); //测试不存在的suiteID值为0,cases值为多个 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/testsuite/select.php b/test/model/testsuite/select.php new file mode 100755 index 0000000000..22bbac8248 --- /dev/null +++ b/test/model/testsuite/select.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +select(); +cid=1 +pid=1 + + + +*/ + +$testsuite = new testsuiteTest(); + +r($testsuite->selectTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testsuite/update.php b/test/model/testsuite/update.php new file mode 100755 index 0000000000..f6f01d4798 --- /dev/null +++ b/test/model/testsuite/update.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +测试productID为1,name正常存在,type为private >> type,public,private +测试productID为1,name为空,type为private >> 『名称』不能为空。 +测试productID为1,name正常存在,type为public >> type,private,public +测试productID为1,name为空,type为public >> 『名称』不能为空。 +测试productID为1,name正常存在,type为空 >> type,public, +测试productID为1,name为空,type为空 >> 『名称』不能为空。 +测试productID为0,name正常存在,type为private >> 0 +测试productID为0,name为空,type为private >> 『名称』不能为空。 +测试productID为0,name正常存在,type为public >> 0 +测试productID为0,name为空,type为public >> 『名称』不能为空。 +测试productID为0,name正常存在,type为空 >> 0 +测试productID为0,name为空,type为空 >> 『名称』不能为空。 + +*/ +$productID = array(1, 0); +$name = array('这是测试套件名称1000', ''); +$type = array('private', 'public', ''); + +$testsuite = new testsuiteTest(); + +r($testsuite->updateTest($productID[0], $name[0], $type[0])) && p('2:field,old,new') && e('type,public,private'); //测试productID为1,name正常存在,type为private +r($testsuite->updateTest($productID[0], $name[1], $type[0])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为private +r($testsuite->updateTest($productID[0], $name[0], $type[1])) && p('0:field,old,new') && e('type,private,public'); //测试productID为1,name正常存在,type为public +r($testsuite->updateTest($productID[0], $name[1], $type[1])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为public +r($testsuite->updateTest($productID[0], $name[0], $type[2])) && p('0:field,old,new') && e('type,public,'); //测试productID为1,name正常存在,type为空 +r($testsuite->updateTest($productID[0], $name[1], $type[2])) && p('name:0') && e('『名称』不能为空。'); //测试productID为1,name为空,type为空 +r($testsuite->updateTest($productID[1], $name[0], $type[0])) && p() && e('0'); //测试productID为0,name正常存在,type为private +r($testsuite->updateTest($productID[1], $name[1], $type[0])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为private +r($testsuite->updateTest($productID[1], $name[0], $type[1])) && p() && e('0'); //测试productID为0,name正常存在,type为public +r($testsuite->updateTest($productID[1], $name[1], $type[1])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为public +r($testsuite->updateTest($productID[1], $name[0], $type[2])) && p() && e('0'); //测试productID为0,name正常存在,type为空 +r($testsuite->updateTest($productID[1], $name[1], $type[2])) && p('name:0') && e('『名称』不能为空。'); //测试productID为0,name为空,type为空 +system("./ztest init"); \ No newline at end of file