+ enhanced testtask feature.
This commit is contained in:
@@ -4,6 +4,8 @@ $config->testcase->search['module'] = 'testcase';
|
||||
$config->testcase->search['fields']['title'] = $lang->testcase->title;
|
||||
$config->testcase->search['fields']['id'] = $lang->testcase->id;
|
||||
$config->testcase->search['fields']['keywords'] = $lang->testcase->keywords;
|
||||
$config->testcase->search['fields']['product'] = $lang->testcase->product;
|
||||
$config->testcase->search['fields']['module'] = $lang->testcase->module;
|
||||
$config->testcase->search['fields']['openedBy'] = $lang->testcase->openedBy;
|
||||
$config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedByAB;
|
||||
$config->testcase->search['fields']['status'] = $lang->testcase->status;
|
||||
@@ -15,6 +17,8 @@ $config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEdi
|
||||
|
||||
$config->testcase->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->testcase->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->testcase->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->testcase->search['params']['module'] = array('operator' => '=', 'control' => 'select', 'values' => 'modules');
|
||||
$config->testcase->search['params']['openedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->testcase->search['params']['lastEditedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
|
||||
$config->testcase->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->testcase->statusList);
|
||||
|
||||
@@ -51,6 +51,7 @@ $lang->testcase->linkCase = 'Related cases';
|
||||
$lang->testcase->stage = 'Stage';
|
||||
$lang->testcase->lastEditedByAB = 'Last edited by';
|
||||
$lang->testcase->lastEditedDateAB = 'Last edited date';
|
||||
$lang->testcase->allProduct = 'All product';
|
||||
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
|
||||
|
||||
$lang->testcase->stepID = 'ID';
|
||||
|
||||
@@ -51,6 +51,7 @@ $lang->testcase->linkCase = '相关用例';
|
||||
$lang->testcase->stage = '适用阶段';
|
||||
$lang->testcase->lastEditedByAB = '修改者';
|
||||
$lang->testcase->lastEditedDateAB = '修改日期';
|
||||
$lang->testcase->allProduct = '所有产品';
|
||||
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
|
||||
|
||||
$lang->testcase->stepID = '编号';
|
||||
|
||||
@@ -116,32 +116,51 @@ class testtask extends control
|
||||
}
|
||||
|
||||
/* 查看任务的用例列表。*/
|
||||
public function cases($taskID)
|
||||
public function cases($taskID, $browseType = 'byModule', $param = 0)
|
||||
{
|
||||
$this->app->loadLang('testcase');
|
||||
$this->session->set('caseList', $this->app->getURI(true));
|
||||
|
||||
/* 设置浏览模式,产品ID和模块ID。 */
|
||||
$browseType = strtolower($browseType);
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
|
||||
/* 获取task和产品信息,并设置菜单。*/
|
||||
$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);
|
||||
|
||||
/* 如果是按照模块查找,或者列出所有。*/
|
||||
if($browseType == 'bymodule' or $browseType == 'all')
|
||||
{
|
||||
$modules = '';
|
||||
if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
|
||||
$this->view->runs = $this->testtask->getRuns($taskID, $modules);
|
||||
}
|
||||
elseif($browseType == 'assignedtome')
|
||||
{
|
||||
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account);
|
||||
}
|
||||
|
||||
/* 导航信息。*/
|
||||
$this->view->header['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->cases;
|
||||
|
||||
/* 赋值。*/
|
||||
$this->view->productID = $productID;
|
||||
$this->view->task = $task;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
|
||||
$this->view->runs = $this->testtask->getRuns($taskID);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->task = $task;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
|
||||
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->taskID = $taskID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
/* 编辑一个Bug。*/
|
||||
public function edit($taskID)
|
||||
{
|
||||
@@ -209,6 +228,7 @@ class testtask extends control
|
||||
|
||||
/* 构造搜索表单。*/
|
||||
$this->loadModel('testcase');
|
||||
$this->config->testcase->search['params']['product']['values']= array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
|
||||
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
|
||||
$this->config->testcase->search['actionURL'] = inlink('linkcase', "taskID=$taskID");
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->testcase->search);
|
||||
@@ -223,8 +243,9 @@ class testtask extends control
|
||||
|
||||
/* 获得用例列表。*/
|
||||
if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
|
||||
$query = str_replace("`product` = 'all'", '1', $this->session->testcaseQuery); // 如果指定了搜索所有的产品,去掉这个查询条件。
|
||||
$linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
|
||||
$this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQuery)
|
||||
$this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
|
||||
->andWhere('product')->eq($productID)
|
||||
->andWhere('id')->notIN($linkedCases)
|
||||
->andWhere('deleted')->eq(0)
|
||||
|
||||
@@ -62,6 +62,10 @@ $lang->testtask->linkedCases = 'Linked cases';
|
||||
$lang->testtask->confirmDelete = 'Are you sure to delete this test task?';
|
||||
$lang->testtask->passAll = 'Pass all';
|
||||
|
||||
$lang->testtask->byModule = 'By module';
|
||||
$lang->testtask->assignedToMe = 'Assgined to me';
|
||||
$lang->testtask->allCases = 'All Cases';
|
||||
|
||||
$lang->testtask->lblCases = 'Case list';
|
||||
$lang->testtask->lblUnlinkCase = 'Remove case';
|
||||
$lang->testtask->lblRunCase = 'Run';
|
||||
|
||||
@@ -62,6 +62,10 @@ $lang->testtask->linkedCases = '已关联用例列表';
|
||||
$lang->testtask->confirmDelete = '您确认要删除该测试任务吗?';
|
||||
$lang->testtask->passAll = '全部通过';
|
||||
|
||||
$lang->testtask->byModule = '按模块';
|
||||
$lang->testtask->assignedToMe = '指派给我';
|
||||
$lang->testtask->allCases = '所有Case';
|
||||
|
||||
$lang->testtask->lblCases = '用例列表';
|
||||
$lang->testtask->lblUnlinkCase = '移除用例';
|
||||
$lang->testtask->lblRunCase = '执行用例';
|
||||
|
||||
@@ -101,11 +101,22 @@ class testtaskModel extends model
|
||||
}
|
||||
|
||||
/* 获得任务的执行用例列表。*/
|
||||
public function getRuns($taskID)
|
||||
public function getRuns($taskID, $moduleID)
|
||||
{
|
||||
return $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
|
||||
->where('t1.task')->eq((int)$taskID)
|
||||
->beginIF($moduleID)->andWhere('t2.module')->in($moduleID)->fi()
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/* 获得需要用户执行的用例列表。*/
|
||||
public function getUserRuns($taskID, $user)
|
||||
{
|
||||
return $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
|
||||
->where('t1.task')->eq((int)$taskID)
|
||||
->andWhere('t1.assignedTo')->eq($user)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<?php include '../../common/view/treeview.html.php';?>
|
||||
<?php include '../../common/view/table2csv.html.php';?>
|
||||
<script language='javascript'>
|
||||
$(document).ready(function()
|
||||
{
|
||||
@@ -37,67 +39,97 @@ function checkall(checker)
|
||||
$(this).attr("checked", checker.checked)
|
||||
});
|
||||
}
|
||||
/* 切换至按模块浏览。*/
|
||||
function browseByModule(active)
|
||||
{
|
||||
$('#mainbox').addClass('yui-t1');
|
||||
$('#treebox').removeClass('hidden');
|
||||
$('#bymoduleTab').addClass('active');
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
}
|
||||
</script>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' action='<?php echo inlink('batchAssign', "task=$task->id");?>' target='hiddenwin'>
|
||||
<table class='table-1 tablesorter'>
|
||||
<caption class='caption-tl'>
|
||||
<div class='f-left'><?php echo $lang->testtask->linkedCases;?></div>
|
||||
<div class='f-right'>
|
||||
<?php
|
||||
common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCase);
|
||||
echo html::a($this->session->testtaskList, $lang->goback);
|
||||
?>
|
||||
</div>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'><nobr><?php echo $lang->idAB;?></nobr></th>
|
||||
<th class='w-pri'><?php echo $lang->priAB;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->title;?></th>
|
||||
<th><?php echo $lang->testcase->type;?></th>
|
||||
<th><?php echo $lang->testtask->assignedTo;?></th>
|
||||
<th class='w-80px'><?php echo $lang->testtask->lastRun;?></th>
|
||||
<th class='w-80px'><?php echo $lang->testtask->lastResult;?></th>
|
||||
<th><?php echo $lang->statusAB;?></th>
|
||||
<th class='w-150px {sorter: false}'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($runs as $run):?>
|
||||
<tr class='a-center'>
|
||||
<td class='a-left'><?php echo "<input type='checkbox' name='cases[]' value='$run->case' /> "; printf('%03d', $run->case);?></td>
|
||||
<td><?php echo $run->pri?></td>
|
||||
<td class='a-left nobr'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version"), $run->title, '_blank');?>
|
||||
</td>
|
||||
<td><?php echo $lang->testcase->typeList[$run->type];?></td>
|
||||
<td><?php $assignedTo = $users[$run->assignedTo]; echo substr($assignedTo, strpos($assignedTo, ':') + 1);?></td>
|
||||
<td><?php if(!helper::isZeroDate($run->lastRun)) echo date(DT_MONTHTIME1, strtotime($run->lastRun));?></td>
|
||||
<td class='<?php echo $run->lastResult;?>'><?php if($run->lastResult) echo $lang->testcase->resultList[$run->lastResult];?></td>
|
||||
<td class='<?php echo $run->status;?>'><?php echo $lang->testtask->statusList[$run->status];?></td>
|
||||
<td>
|
||||
<?php
|
||||
common::printLink('testtask', 'runcase', "id=$run->id", $lang->testtask->runCase, '', 'class="iframe"');
|
||||
common::printLink('testtask', 'results', "id=$run->id", $lang->testtask->results, '', 'class="iframe"');
|
||||
common::printLink('bug', 'create', "product=$productID&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,runID=$run->id", $lang->testtask->createBug);
|
||||
common::printLink('testtask', 'unlinkcase', "id=$run->id", $lang->testtask->unlinkCase, 'hiddenwin');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td><nobr><?php echo "<input type='checkbox' onclick='checkall(this);'> " . $lang->selectAll;?></nobr></td>
|
||||
<td colspan='9'>
|
||||
<?php
|
||||
echo html::select('assignedTo', $users);
|
||||
echo html::submitButton($lang->testtask->assign);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\"><a href='#'>" . $lang->testtask->byModule . "</a></span> ";
|
||||
echo "<span id='allTab'>" . html::a($this->inlink('cases', "taskID=$taskID&browseType=all¶m=0"), $lang->testtask->allCases) . "</span>";
|
||||
echo "<span id='assignedtomeTab'>" . html::a($this->inlink('cases', "taskID=$taskID&browseType=assignedtome¶m=0"), $lang->testtask->assignedToMe) . "</span>";
|
||||
?>
|
||||
</div>
|
||||
<div class='f-right'>
|
||||
<?php
|
||||
echo html::export2csv($lang->exportCSV, $lang->setFileName);
|
||||
common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCase);
|
||||
echo html::a($this->session->testtaskList, $lang->goback);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='yui-d0 <?php if($browseType == 'bymodule') echo 'yui-t1';?>' id='mainbox'>
|
||||
<div class='yui-main'>
|
||||
<div class='yui-b'>
|
||||
<form method='post' action='<?php echo inlink('batchAssign', "task=$task->id");?>' target='hiddenwin'>
|
||||
<table class='table-1 tablesorter datatable mb-zero'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'><nobr><?php echo $lang->idAB;?></nobr></th>
|
||||
<th class='w-pri'><?php echo $lang->priAB;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->title;?></th>
|
||||
<th><?php echo $lang->testcase->type;?></th>
|
||||
<th><?php echo $lang->testtask->assignedTo;?></th>
|
||||
<th class='w-80px'><?php echo $lang->testtask->lastRun;?></th>
|
||||
<th class='w-80px'><?php echo $lang->testtask->lastResult;?></th>
|
||||
<th><?php echo $lang->statusAB;?></th>
|
||||
<th class='w-150px {sorter: false}'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($runs as $run):?>
|
||||
<tr class='a-center'>
|
||||
<td class='a-left'><?php echo "<input type='checkbox' name='cases[]' value='$run->case' /> "; printf('%03d', $run->case);?></td>
|
||||
<td><?php echo $run->pri?></td>
|
||||
<td class='a-left nobr'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version"), $run->title, '_blank');?>
|
||||
</td>
|
||||
<td><?php echo $lang->testcase->typeList[$run->type];?></td>
|
||||
<td><?php $assignedTo = $users[$run->assignedTo]; echo substr($assignedTo, strpos($assignedTo, ':') + 1);?></td>
|
||||
<td><?php if(!helper::isZeroDate($run->lastRun)) echo date(DT_MONTHTIME1, strtotime($run->lastRun));?></td>
|
||||
<td class='<?php echo $run->lastResult;?>'><?php if($run->lastResult) echo $lang->testcase->resultList[$run->lastResult];?></td>
|
||||
<td class='<?php echo $run->status;?>'><?php echo $lang->testtask->statusList[$run->status];?></td>
|
||||
<td>
|
||||
<?php
|
||||
common::printLink('testtask', 'runcase', "id=$run->id", $lang->testtask->runCase, '', 'class="iframe"');
|
||||
common::printLink('testtask', 'results', "id=$run->id", $lang->testtask->results, '', 'class="iframe"');
|
||||
common::printLink('bug', 'create', "product=$productID&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,runID=$run->id", $lang->testtask->createBug);
|
||||
common::printLink('testtask', 'unlinkcase', "id=$run->id", $lang->testtask->unlinkCase, 'hiddenwin');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class='table-1'>
|
||||
<tr>
|
||||
<td><nobr><?php echo "<input type='checkbox' onclick='checkall(this);'> " . $lang->selectAll;?></nobr></td>
|
||||
<td colspan='9'>
|
||||
<?php
|
||||
echo html::select('assignedTo', $users);
|
||||
echo html::submitButton($lang->testtask->assign);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class='yui-b <?php if($browseType != 'bymodule') echo 'hidden';?>' id='treebox'>
|
||||
<div class='box-title'><?php echo $productName;?></div>
|
||||
<div class='box-content'><?php echo $moduleTree;?></div>
|
||||
</div>
|
||||
</div>
|
||||
<script language="Javascript">
|
||||
$("#<?php echo $browseType;?>Tab").addClass('active');
|
||||
$("#module<?php echo $moduleID;?>").addClass('active');
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user