diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 23da76b35f..cfcb0572d6 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -222,7 +222,7 @@ $lang->testcase->menu = new stdclass(); $lang->testcase->menu->product = '%s'; $lang->testcase->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); $lang->testcase->menu->testcase = array('link' => 'Case|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase', 'subModule' => 'tree'); -$lang->testcase->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun'); +$lang->testcase->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase'); $lang->testtask = new stdclass(); $lang->testtask->menu = $lang->testcase->menu; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 5dbd708a67..7e713b6a38 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -222,7 +222,7 @@ $lang->testcase->menu = new stdclass(); $lang->testcase->menu->product = '%s'; $lang->testcase->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); $lang->testcase->menu->testcase = array('link' => '用例|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase', 'subModule' => 'tree'); -$lang->testcase->menu->testtask = array('link' => '版本|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun'); +$lang->testcase->menu->testtask = array('link' => '版本|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase'); $lang->testtask = new stdclass(); $lang->testtask->menu = $lang->testcase->menu; diff --git a/module/testtask/control.php b/module/testtask/control.php index 9d858bf811..ce48875219 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -313,6 +313,49 @@ class testtask extends control $this->display(); } + public function groupCase($taskID, $groupBy = 'story') + { + /* Save the session. */ + $this->app->loadLang('testcase'); + $this->session->set('caseList', $this->app->getURI(true)); + + /* Get task and product info, set menu. */ + $groupBy = empty($groupBy) ? 'story' : $groupBy; + $task = $this->testtask->getById($taskID); + if(!$task) die(js::error($this->lang->notFound) . js::locate('back')); + $productID = $task->product; + $this->testtask->setMenu($this->products, $productID); + + $runs = $this->testtask->getRuns($taskID, 0, $groupBy); + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); + + $groupCases = array(); + $groupByList = array(); + foreach($runs as $run) + { + if($groupBy == 'story') + { + $groupCases[$run->story][] = $run; + $groupByList[$run->story] = $run->storyTitle; + } + } + + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; + $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = $this->lang->testtask->common; + $this->view->position[] = $this->lang->testtask->cases; + + $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->productID = $productID; + $this->view->task = $task; + $this->view->taskID = $taskID; + $this->view->browseType = 'group'; + $this->view->groupBy = $groupBy; + $this->view->groupByList = $groupByList; + $this->view->cases = $groupCases; + $this->display(); + } + /** * Edit a test task. * diff --git a/module/testtask/js/groupcase.js b/module/testtask/js/groupcase.js new file mode 100644 index 0000000000..8157df3154 --- /dev/null +++ b/module/testtask/js/groupcase.js @@ -0,0 +1,4 @@ +$(document).ready(function() +{ + $('#' + browseType + 'Tab').addClass('active'); +}); diff --git a/module/testtask/model.php b/module/testtask/model.php index 4c2a105f51..41f5254108 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -240,8 +240,9 @@ class testtaskModel extends model { $orderBy = strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy); - return $this->dao->select('t2.*,t1.*,t2.version as caseVersion')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*,t1.*,t2.version as caseVersion,t3.title as storyTitle')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') + ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') ->where('t1.task')->eq((int)$taskID) ->beginIF($moduleID)->andWhere('t2.module')->in($moduleID)->fi() ->orderBy($orderBy) diff --git a/module/testtask/view/caseheader.html.php b/module/testtask/view/caseheader.html.php new file mode 100644 index 0000000000..0b2e390a3f --- /dev/null +++ b/module/testtask/view/caseheader.html.php @@ -0,0 +1,41 @@ +app->getModuleRoot() . 'common/view/dropmenu.html.php';?> +
+
icons['usecase']);?>
+ +
+ "; + common::printIcon('testtask', 'linkCase', "taskID=$task->id", '', 'button', 'link'); + common::printIcon('testcase', 'export', "productID=$productID&orderBy=`case`_desc&taskID=$task->id", '', 'button', '', '', 'iframe'); + echo '
'; + echo "
"; + common::printRPN($this->session->testtaskList, ''); + echo '
'; + ?> +
+
'>
+ + + diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 2e9619ee14..8297ae5399 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -13,33 +13,12 @@ + testtask->confirmUnlinkCase)?> -
-
icons['usecase']);?>
- -
- "; - common::printIcon('testtask', 'linkCase', "taskID=$task->id", '', 'button', 'link'); - common::printIcon('testcase', 'export', "productID=$productID&orderBy=`case`_desc&taskID=$task->id", '', 'button', '', '', 'iframe'); - echo '
'; - echo "
"; - common::printRPN($this->session->testtaskList, ''); - echo '
'; - ?> -
-
'>
-
diff --git a/module/testtask/view/groupcase.html.php b/module/testtask/view/groupcase.html.php new file mode 100644 index 0000000000..2c9adf8a8b --- /dev/null +++ b/module/testtask/view/groupcase.html.php @@ -0,0 +1,59 @@ + + * @package testcase + * @version $Id$ + * @link http://www.zentao.net + */ +?> + + + + + + + + + + + + + + + + + + + + + $groupTasks):?> + + + + + + + createLink('case','view',"caseID=$case->id"); ?> + + + + + + + + + + + + + + +
testcase->title;?> priAB;?> typeAB;?> testtask->assignedTo;?> testtask->lastRunAccount;?>testtask->lastRunTime;?> testtask->lastRunResult;?> testtask->status;?> actions;?>
 id . $lang->colon; if(!common::printLink('testcase', 'view', "case=$case->id", $case->title)) echo $case->title;?>pri?>'>pri;?>case->typeList[$case->type];?>assignedTo];?>lastRunner];?>lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?>lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?>version < $case->caseVersion) ? "{$lang->testcase->changed}" : $lang->testtask->statusList[$case->status];?> + id", '', 'list');?> + id", '', 'list', '', 'hiddenwin');?> +
+