- |
+ |
project->productStories, inlink('linkStory', "project={$project->id}"));
diff --git a/module/testcase/css/batchedit.css b/module/testcase/css/batchedit.css
index df6b376c7a..4c4be58690 100644
--- a/module/testcase/css/batchedit.css
+++ b/module/testcase/css/batchedit.css
@@ -1,3 +1,4 @@
.w-340px {width:340px}
.chosen {z-index:99}
.chosen-container[id^="module"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important}
+.chosen-container[id^="stories"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important}
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 20d757a4a6..1ad30ca017 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -720,6 +720,7 @@ class testcaseModel extends model
if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3;
if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0;
if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : '';
+ if($data->stories[$caseID] == '') $data->stories[$caseID] = 0;
$prev['pri'] = $data->pris[$caseID];
$prev['module'] = $data->modules[$caseID];
@@ -1264,7 +1265,7 @@ class testcaseModel extends model
{
$caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`case`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count');
$results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`case`')->in($caseIdList)->groupBy('`case`')->fetchPairs('case', 'count');
- $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchAll('name');
+ $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchPairs('name','value');
$stepNumber = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.`case`=t2.`id`')
->where('t1.`case`')->in($caseIdList)
@@ -1287,10 +1288,10 @@ class testcaseModel extends model
foreach($cases as $key => $case)
{
$caseID = $type == 'case' ? $case->id : $case->case;
- $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
- $case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
- $case->caseFailCount = isset($results[$caseID]) ? $caseFailCount[$caseID]->value : 0;
- $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0;
+ $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
+ $case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
+ $case->caseFailCount = isset($caseFailCount[$caseID])? $caseFailCount[$caseID] : 0;
+ $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0;
}
return $cases;
diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php
index a1c134d60c..f3fa234c67 100644
--- a/module/testcase/view/batchedit.html.php
+++ b/module/testcase/view/batchedit.html.php
@@ -36,7 +36,7 @@ foreach(explode(',', $showFields) as $field)
'> priAB;?> |
'>statusAB;?> |
'>testcase->module;?> |
- '>testcase->story;?> |
+ '>testcase->story;?> |
testcase->title;?> |
testcase->type;?> |
'> testcase->precondition;?> |
diff --git a/module/testcase/view/createbug.html.php b/module/testcase/view/createbug.html.php
index bb5433aa15..be64fed70c 100644
--- a/module/testcase/view/createbug.html.php
+++ b/module/testcase/view/createbug.html.php
@@ -11,7 +11,7 @@
*/
?>
-
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 24bdad5b64..1461b904c9 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -438,19 +438,19 @@ class testtask extends control
}
/**
- * doing testtask.
+ * activate testtask.
*
* @param int $taskID
* @access public
* @return void
*/
- public function doing($taskID)
+ public function activate($taskID)
{
$actions = $this->loadModel('action')->getList('testtask', $taskID);
if(!empty($_POST))
{
- $changes = $this->testtask->doing($taskID);
+ $changes = $this->testtask->activate($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
@@ -473,7 +473,7 @@ class testtask extends control
$this->view->testtask = $testtask;
$this->view->title = $testtask->name . $this->lang->colon . $this->lang->testtask->start;
$this->view->position[] = $this->lang->testtask->common;
- $this->view->position[] = $this->lang->testtask->doing;
+ $this->view->position[] = $this->lang->testtask->activate;
$this->view->actions = $actions;
$this->display();
}
@@ -655,10 +655,10 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->linkCase;
- $testTask = $this->testtask->getTestTask($productID,$taskID);
+ $testTask = $this->testtask->getRelatedTestTasks($productID,$taskID);
/* Get cases. */
- $cases = $this->testtask->getCases($productID, $task, $taskID, $type, $param, $pager);
+ $cases = $this->testtask->getLinkableCases($productID, $task, $taskID, $type, $param, $pager);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->cases = $cases;
diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php
index 251bd02764..c4271ac95c 100644
--- a/module/testtask/lang/zh-cn.php
+++ b/module/testtask/lang/zh-cn.php
@@ -33,8 +33,8 @@ $lang->testtask->start = "开始";
$lang->testtask->close = "关闭";
$lang->testtask->wait = "待测版本";
$lang->testtask->blocked = "阻塞";
-$lang->testtask->doing = "激活";
-$lang->testtask->doingA = "进行中版本";
+$lang->testtask->activate = "激活";
+$lang->testtask->testing = "测试中版本";
$lang->testtask->blockedA = "被阻塞版本";
$lang->testtask->done = "已测版本";
diff --git a/module/testtask/model.php b/module/testtask/model.php
index 05aa248ab6..f2bdf5aac0 100644
--- a/module/testtask/model.php
+++ b/module/testtask/model.php
@@ -141,31 +141,6 @@ class testtaskModel extends model
return $task;
}
- /**
- * Bet tasks by project.
- *
- * @param int $projectID
- * @access public
- * @return array
- */
- public function getByProject($projectID)
- {
- return $this->dao->select('*')->from(TABLE_TESTTASK)->where('project')->eq((int)$projectID)->andWhere('deleted')->eq(0)->fetchAll('id');
- }
-
- /**
- * Get taskrun by case id.
- *
- * @param int $taskID
- * @param int $caseID
- * @access public
- * @return void
- */
- public function getRunByCase($taskID, $caseID)
- {
- return $this->dao->select('*')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->andWhere('`case`')->eq($caseID)->fetch();
- }
-
/**
* Get test tasks by user.
*
@@ -188,6 +163,190 @@ class testtaskModel extends model
->fetchAll();
}
+
+
+ /**
+ * Get taskrun by case id.
+ *
+ * @param int $taskID
+ * @param int $caseID
+ * @access public
+ * @return void
+ */
+ public function getRunByCase($taskID, $caseID)
+ {
+ return $this->dao->select('*')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->andWhere('`case`')->eq($caseID)->fetch();
+ }
+
+ /**
+ * Get linkable casses.
+ *
+ * @param int $productID
+ * @param object $task
+ * @param int $taskID
+ * @param string $type
+ * @param string $param
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getLinkableCases($productID, $task, $taskID, $type, $param, $pager)
+ {
+ if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
+ $query = $this->session->testcaseQuery;
+ $allProduct = "`product` = 'all'";
+ if(strpos($query, '`product` =') === false && $type != 'bysuite') $query .= " AND `product` = $productID";
+ if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query);
+
+ $cases = array();
+ $linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
+ if($type == 'all') $cases = $this->getAllLinkableCases($task, $query, $linkedCases, $pager);
+ if($type == 'bystory') $cases = $this->getLinkableCasesByStory($productID, $task, $query, $linkedCases, $pager);
+ if($type == 'bybug') $cases = $this->getLinkableCasesByBug($productID, $task, $query, $linkedCases, $pager);
+ if($type == 'bysuite') $cases = $this->getLinkableCasesBySuite($productID, $query, $param, $linkedCases, $pager);
+ if($type == 'bybuild') $cases = $this->getLinkableCasesByTestTask($param, $linkedCases, $pager);
+
+ return $cases;
+ }
+
+ /**
+ * Get all linkable cases.
+ *
+ * @param object $task
+ * @param string $query
+ * @param array $linkedCases
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getAllLinkableCases($task, $query, $linkedCases, $pager)
+ {
+ return $this->dao->select('*')->from(TABLE_CASE)->where($query)
+ ->andWhere('id')->notIN($linkedCases)
+ ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
+ ->andWhere('deleted')->eq(0)
+ ->orderBy('id desc')
+ ->page($pager)
+ ->fetchAll();
+ }
+
+ /**
+ * Get linkable cases by story.
+ *
+ * @param int $productID
+ * @param object $task
+ * @param string $query
+ * @param array $linkedCases
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getLinkableCasesByStory($productID, $task, $query, $linkedCases, $pager)
+ {
+ $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories');
+ $cases = array();
+ if($stories)
+ {
+ $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
+ ->andWhere('product')->eq($productID)
+ ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
+ ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
+ ->andWhere('story')->in(trim($stories, ','))
+ ->andWhere('deleted')->eq(0)
+ ->orderBy('id desc')
+ ->page($pager)
+ ->fetchAll();
+ }
+
+ return $cases;
+ }
+
+ /**
+ * Get linkable cases by bug.
+ *
+ * @param int $productID
+ * @param object $task
+ * @param string $query
+ * @param array $linkedCases
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getLinkableCasesByBug($productID, $task, $query, $linkedCases, $pager)
+ {
+ $bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs');
+ $cases = array();
+ if($bugs)
+ {
+ $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
+ ->andWhere('product')->eq($productID)
+ ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
+ ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
+ ->andWhere('fromBug')->in(trim($bugs, ','))
+ ->andWhere('deleted')->eq(0)
+ ->orderBy('id desc')
+ ->page($pager)
+ ->fetchAll();
+ }
+
+ return $cases;
+ }
+
+ /**
+ * Get linkable cases by suite.
+ *
+ * @param int $productID
+ * @param string $query
+ * @param string $suite
+ * @param array $linkedCases
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getLinkableCasesBySuite($productID, $query, $suite, $linkedCases, $pager)
+ {
+ return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1')
+ ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
+ ->where($query)
+ ->andWhere('t2.suite')->eq((int)$suite)
+ ->andWhere('t1.product')->eq($productID)
+ ->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi()
+ ->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi()
+ ->andWhere('deleted')->eq(0)
+ ->orderBy('id desc')
+ ->page($pager)
+ ->fetchAll();
+ }
+
+ /**
+ * Get linkeable cases by test task.
+ *
+ * @param string $testTask
+ * @param object $pager
+ * @access public
+ * @return array
+ */
+ public function getLinkableCasesByTestTask($testTask, $linkedCases, $pager)
+ {
+ $runList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('id')->notIN($linkedCases)->fetchPairs('case');
+
+ $caseList = $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($runList)->page($pager)->fetchAll();
+ return $caseList;
+ }
+
+ /**
+ * Get related test tasks.
+ *
+ * @param int $productID
+ * @param int $taskID
+ * @access public
+ * @return array
+ */
+ public function getRelatedTestTasks($productID,$taskID)
+ {
+ return $this->dao->select('id, name')->from(TABLE_TESTTASK)->where("product = '$productID'")->orderBy('id desc')->fetchPairs('id', 'name');
+ }
+
/**
* Update a test task.
*
@@ -265,13 +424,13 @@ class testtaskModel extends model
}
/**
- * blocked testtask.
+ * update block testtask.
*
* @param int $taskID
- * @access public
+ * @access public
* @return void
*/
- public function blocked($taskID)
+ public function block($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
@@ -287,13 +446,13 @@ class testtaskModel extends model
}
/**
- * doing testtask.
+ * update activate testtask.
*
* @param int $taskID
* @access public
* @return void
*/
- public function doing($taskID)
+ public function activate($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
@@ -331,174 +490,6 @@ class testtaskModel extends model
}
}
- /**
- * Get all cases.
- *
- * @param string $query
- * @param array $linkedCases
- * @param object $pager
- * @access public
- * @return void
- */
- public function getAllCases($query,$linkedCases,$pager)
- {
- return $this->dao->select('*')->from(TABLE_CASE)->where($query)
- ->andWhere('id')->notIN($linkedCases)
- ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
- ->andWhere('deleted')->eq(0)
- ->orderBy('id desc')
- ->page($pager)
- ->fetchAll();
- }
-
- /**
- * Get cases by story.
- *
- * @param array $task
- * @param int $productID
- * @param string $query
- * @param array $linkedCases
- * @param object $pager
- * @access public
- * @return array
- */
- public function getCasesByStory($task,$productID,$query,$linkedCases,$pager)
- {
- $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories');
- $cases = array();
- if($stories)
- {
- $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
- ->andWhere('product')->eq($productID)
- ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
- ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
- ->andWhere('story')->in(trim($stories, ','))
- ->andWhere('deleted')->eq(0)
- ->orderBy('id desc')
- ->page($pager)
- ->fetchAll();
- }
-
- return $cases;
- }
-
- /**
- * Get cases by bug.
- *
- * @param array $task
- * @param int $productID
- * @param string $query
- * @param array $linkedCases
- * @param object $pager
- * @access public
- * @return array
- */
- public function getCasesByBug($task,$productID,$query,$linkedCases,$pager)
- {
- $bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs');
- $cases = array();
- if($bugs)
- {
- $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
- ->andWhere('product')->eq($productID)
- ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
- ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
- ->andWhere('fromBug')->in(trim($bugs, ','))
- ->andWhere('deleted')->eq(0)
- ->orderBy('id desc')
- ->page($pager)
- ->fetchAll();
- }
-
- return $cases;
- }
-
- /**
- * Get cases by suite.
- *
- * @param int $productID
- * @param string $query
- * @param array $linkedCases
- * @param string $param
- * @param object $pager
- * @access public
- * @return array
- */
- public function getCasesBySuite($productID,$query,$linkedCases,$pager,$param)
- {
- return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1')
- ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
- ->where($query)
- ->andWhere('t2.suite')->eq((int)$param)
- ->andWhere('t1.product')->eq($productID)
- ->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi()
- ->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi()
- ->andWhere('deleted')->eq(0)
- ->orderBy('id desc')
- ->page($pager)
- ->fetchAll();
- }
-
- /**
- * Get cases by version.
- *
- * @param string $param
- * @param object $pager
- * @access public
- * @return array
- */
- public function getCasesByVersion($pager, $param)
- {
- $runListValue = array();
- $runList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where("task = '$param'")->fetchPairs('case');
-
- $caseList = $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($runList)->page($pager)->fetchAll();
- return $caseList;
- }
-
- /**
- * Get cases.
- *
- * @param int $productID
- * @param array $task
- * @param int $taskID
- * @param string $type
- * @param string $param
- * @param object $pager
- * @access public
- * @return array
- */
- public function getCases($productID, $task, $taskID, $type, $param, $pager)
- {
- if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
- $query = $this->session->testcaseQuery;
- $allProduct = "`product` = 'all'";
- if(strpos($query, '`product` =') === false && $type != 'bysuite') $query .= " AND `product` = $productID";
- if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query);
-
- $linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
- if($type == 'all') $cases = $this->getAllCases($query,$linkedCases,$pager);
- else if($type == 'bystory') $cases = $this->getCasesByStory($task,$productID,$query,$linkedCases,$pager);
- else if($type == 'bybug') $cases = $this->getCasesByBug($task,$productID,$query,$linkedCases,$pager);
- else if($type == 'bysuite') $cases = $this->getCasesBySuite($productID,$query,$linkedCases,$pager,$param);
- else if($type == 'byversion') $cases = $this->getCasesByVersion($pager,$param);
-
- return $cases;
- }
-
- /**
- * Get test tasks.
- *
- * @param int $productID
- * @param int $taskID
- * @access public
- * @return array
- */
- public function getTestTask($productID,$taskID)
- {
- return $this->dao->select('id,name')->from(TABLE_TESTTASK)->where("product = '$productID'")->orderBy('id desc')->fetchPairs('id', 'name');
- }
-
/**
* Get test runs of a test task.
*
diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php
index 7be7773e9d..9a87a79e5a 100644
--- a/module/testtask/view/browse.html.php
+++ b/module/testtask/view/browse.html.php
@@ -15,7 +15,7 @@
- testtask->wait);?>
- - testtask->doingA);?>
+ - testtask->testing);?>
- testtask->blockedA);?>
- testtask->done);?>
diff --git a/module/testtask/view/linkcase.html.php b/module/testtask/view/linkcase.html.php
index 9fc6008b58..211303d768 100644
--- a/module/testtask/view/linkcase.html.php
+++ b/module/testtask/view/linkcase.html.php
@@ -27,8 +27,8 @@
echo "";
diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php
index b1692e79e9..d22c17471a 100644
--- a/module/testtask/view/view.html.php
+++ b/module/testtask/view/view.html.php
@@ -32,7 +32,7 @@
common::printIcon('testtask', 'start', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
common::printIcon('testtask', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe', true);
common::printIcon('testtask', 'blocked', "taskID=$task->id", $task, 'button', 'pause', '', 'iframe', true);
- common::printIcon('testtask', 'doing', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe', true);
+ common::printIcon('testtask', 'activate', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe', true);
common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'button', 'sitemap');
common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'button', 'link');
echo ' ';
|