Merge branch 'sprint/autoTest_liumengyi_bug' into 'master'

* Add auto test of bug.

See merge request easycorp/zentaopms!2330
This commit is contained in:
孙广明
2022-03-17 05:27:17 +00:00
3 changed files with 116 additions and 25 deletions

View File

@@ -199,7 +199,7 @@ class bugTest
/**
* Test check delay bugs.
*
* @param array $productIDList
* @param string $productIDList
* @access public
* @return string
*/
@@ -235,8 +235,8 @@ class bugTest
/**
* Test get bugs of a module.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @param string $moduleIDList
* @access public
* @return string
*/
@@ -268,8 +268,8 @@ class bugTest
/**
* Test get all bugs.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @param string $moduleIDList
* @access public
* @return string
*/
@@ -301,8 +301,8 @@ class bugTest
/**
* Test get bugs of assign to me.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @param string $moduleIDList
* @access public
* @return string
*/
@@ -334,8 +334,8 @@ class bugTest
/**
* Test get bugs of opened by me.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @param string $moduleIDList
* @access public
* @return string
*/
@@ -367,8 +367,7 @@ class bugTest
/**
* Test get bugs of resolved by me.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @access public
* @return string
*/
@@ -400,8 +399,7 @@ class bugTest
/**
* Test get bugs of nobody to do.
*
* @param array $productIDList
* @param array $moduleIDList
* @param string $productIDList
* @access public
* @return string
*/
@@ -433,8 +431,8 @@ class bugTest
/**
* Test get unconfirmed bugs.
*
* @param array $productIDList
* @param array $modules
* @param string $productIDList
* @param string $modules
* @access public
* @return string
*/
@@ -466,8 +464,8 @@ class bugTest
/**
* Test get bugs the overdueBugs is active or unclosed.
*
* @param array $productIDList
* @param array $modules
* @param string $productIDList
* @param string $modules
* @access public
* @return string
*/
@@ -500,8 +498,8 @@ class bugTest
/**
* Test get bugs the status is active or unclosed.
*
* @param array $productIDList
* @param array $modules
* @param string $productIDList
* @param string $modules
* @access public
* @return string
*/
@@ -533,8 +531,8 @@ class bugTest
/**
* Test get unclosed bugs for long time.
*
* @param array $productIDList
* @param array $modules
* @param string $productIDList
* @param string $modules
* @access public
* @return string
*/
@@ -562,4 +560,68 @@ class bugTest
return $title;
}
}
/**
* Test get postponed bugs.
*
* @param string $productIDList
* @access public
* @return string
*/
public function getByPostponedbugsTest($productIDList)
{
global $tester;
$executions = $tester->loadModel('execution')->getPairs('0', 'all', 'empty|withdelete');
$bugs = $this->objectModel->getByPostponedbugs($productIDList, 'all', '0', $executions, 'id_desc', null, 0);
$title = '';
foreach($bugs as $bug)
{
$title .= ',' . $bug->title;
}
$title = trim($title, ',');
$title = str_replace("'", '', $title);
if(dao::isError())
{
return dao::getError();
}
else
{
return $title;
}
}
/**
* Test get bugs need confirm.
*
* @param string $productIDList
* @access public
* @return string
*/
public function getByNeedconfirmTest($productIDList)
{
global $tester;
$executions = $tester->loadModel('execution')->getPairs('0', 'all', 'empty|withdelete');
$bugs = $this->objectModel->getByNeedconfirm($productIDList, 'all', '0', $executions, 'id_desc', null, 0);
$title = '';
foreach($bugs as $bug)
{
$title .= ',' . $bug->title;
}
$title = trim($title, ',');
$title = str_replace("'", '', $title);
if(dao::isError())
{
return dao::getError();
}
else
{
return $title;
}
}
}

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/bug.class.php';
su('admin');
/**
title=bugModel->getByPostponedbugs();
cid=1
pid=1
查询产品25 32 48 100001下被延期的bug >> BUG94,BUG75,BUG74,BUG73
查询产品25下被延期的bug >> BUG75,BUG74,BUG73
查询产品32下被延期的bug >> BUG94
查询产品1下被延期的bug >> 0
查询不存在的产品10001下被延期的bug >> 0
*/
$productIDList = array('25,32,48,1000001', '25' , '32', '1', '1000001');
$bug=new bugTest();
r($bug->getByPostponedBugsTest($productIDList[0])) && p('title') && e('BUG94,BUG75,BUG74,BUG73'); // 查询产品25 32 48 100001下被延期的bug
r($bug->getByPostponedBugsTest($productIDList[1])) && p('title') && e('BUG75,BUG74,BUG73'); // 查询产品25下被延期的bug
r($bug->getByPostponedBugsTest($productIDList[2])) && p('title') && e('BUG94'); // 查询产品32下被延期的bug
r($bug->getByPostponedBugsTest($productIDList[3])) && p('title') && e('0'); // 查询产品1下被延期的bug
r($bug->getByPostponedBugsTest($productIDList[4])) && p('title') && e('0'); // 查询不存在的产品10001下被延期的bug

View File

@@ -54,12 +54,12 @@ r($bug->getByStatusTest($productIDList[0], $moduleIDList[1], $statusList[1])) &&
r($bug->getByStatusTest($productIDList[0], $moduleIDList[1], $statusList[2])) && p('title') && e('0'); // 查询产品1 3 不存在的产品10001 与模块1821状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[0], $moduleIDList[2], $statusList[0])) && p('title') && e('0'); // 查询产品1 3 不存在的产品10001 与不存在的模块1000001 状态为unclosed下未确认的bug
r($bug->getByStatusTest($productIDList[0], $moduleIDList[2], $statusList[1])) && p('title') && e('0'); // 查询产品1 3 不存在的产品10001 与不存在的模块1000001 状态为unresolved下未确认的bug
r($bug->getByStatusTest($productIDList[0], $moduleIDList[2], $statusList[2])) && p('title') && e('BUG1'); // 查询产品1 3 不存在的产品10001 与不存在的模块1000001 状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[0], $moduleIDList[2], $statusList[2])) && p('title') && e('0'); // 查询产品1 3 不存在的产品10001 与不存在的模块1000001 状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[0], $statusList[0])) && p('title') && e('BUG1'); // 查询产品1 与模块1821, 1832 不存在的模块1000001 状态为unclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[0], $statusList[1])) && p('title') && e('0'); // 查询产品1 与模块1821, 1832 不存在的模块1000001 状态为unresolved下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[0], $statusList[2])) && p('title') && e('BUG1'); // 查询产品1 与模块1821, 1832 不存在的模块1000001 状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[0], $statusList[1])) && p('title') && e('BUG1'); // 查询产品1 与模块1821, 1832 不存在的模块1000001 状态为unresolved下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[0], $statusList[2])) && p('title') && e('0'); // 查询产品1 与模块1821, 1832 不存在的模块1000001 状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[1], $statusList[0])) && p('title') && e('BUG1'); // 查询产品1 与模块1821状态为unclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[1], $statusList[1])) && p('title') && e('0'); // 查询产品1 与模块1821状态为unresolved下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[1], $statusList[1])) && p('title') && e('BUG1'); // 查询产品1 与模块1821状态为unresolved下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[1], $statusList[2])) && p('title') && e('0'); // 查询产品1 与模块1821状态为toclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[2], $statusList[0])) && p('title') && e('0'); // 查询产品1 与不存在的模块1000001 状态为unclosed下未确认的bug
r($bug->getByStatusTest($productIDList[1], $moduleIDList[2], $statusList[1])) && p('title') && e('0'); // 查询产品1 与不存在的模块1000001 状态为unresolved下未确认的bug