* finish task #961.
This commit is contained in:
@@ -54,7 +54,7 @@ include '../../common/view/tablesorter.html.php';
|
||||
<tbody>
|
||||
<?php foreach($users as $user):?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo $user->id;?></td>
|
||||
<td><?php echo html::checkbox('userIDList[]', $user->id) . $user->id;?></td>
|
||||
<td><?php if(!common::printLink('user', 'view', "account=$user->account", $user->realname)) echo $user->realname;?></td>
|
||||
<td><?php echo $user->account;?></td>
|
||||
<td><?php echo $lang->user->roleList[$user->role];?></td>
|
||||
@@ -74,7 +74,17 @@ include '../../common/view/tablesorter.html.php';
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tr><td colspan='10'><?php $pager->show()?></td></tr>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='11'>
|
||||
<?php
|
||||
echo html::selectAll();
|
||||
echo html::selectReverse();
|
||||
$pager->show();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -20,6 +20,11 @@ function browseBySearch(active)
|
||||
$('#bymoduleTab').removeClass('active');
|
||||
}
|
||||
|
||||
function changeAction(url)
|
||||
{
|
||||
$('#batchForm').attr('action', url);
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("a.runcase").colorbox({width:900, height:600, iframe:true, transition:'none'});
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
var browseType = '<?php echo $browseType;?>';
|
||||
var moduleID = '<?php echo $moduleID;?>';
|
||||
</script>
|
||||
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
@@ -36,7 +35,6 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
</div>
|
||||
</div>
|
||||
<div id='querybox' class='<?php if($browseType != 'bysearch') echo 'hidden';?>'></div>
|
||||
<form method='post' action='<?php echo $this->inLink('batchEdit', "from=testcaseBrowse&productID=$productID&orderBy=$orderBy");?>'>
|
||||
<table class='cont-lt1'>
|
||||
<tr valign='top'>
|
||||
<td class='side <?php echo $treeClass;?>'>
|
||||
@@ -52,6 +50,7 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
<td class='divider <?php echo $treeClass;?>'></td>
|
||||
<td>
|
||||
<?php $vars = "productID=$productID&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
|
||||
<form id='batchForm' method='post' action='<?php echo inLink('batchEdit', "from=testcaseBrowse&productID=$productID&orderBy=$orderBy");?>'>
|
||||
<table class='table-1 colored tablesorter datatable fixed'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
@@ -108,8 +107,10 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
<tr>
|
||||
<td colspan='10'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
if(common::hasPriv('testcase', 'batchEdit')) echo html::selectAll() . html::selectReverse(). html::submitButton($lang->testcase->batchEdit);
|
||||
<?php
|
||||
echo html::selectAll() . html::selectReverse();
|
||||
if(common::hasPriv('testcase', 'batchEdit'))echo html::submitButton($lang->testcase->batchEdit, "onclick='changeAction(\"" . inLink('batchEdit', "from=testcaseBrowse&productID=$productID&orderBy=$orderBy") . "\")'");
|
||||
if(common::hasPriv('testtask', 'batchRun')) echo html::submitButton($lang->testtask->batchRun, "onclick='changeAction(\"" . $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy") . "\")'");
|
||||
?>
|
||||
</div>
|
||||
<?php $pager->show();?>
|
||||
|
||||
@@ -448,6 +448,53 @@ class testtask extends control
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch run case.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @param string $from
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase')
|
||||
{
|
||||
if(isset($_POST['caseIDList']))
|
||||
{
|
||||
if($from == 'testcase') $this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($this->post->caseIDList)->orderBy($orderBy)->fetchAll('id');
|
||||
if($from == 'testtask')
|
||||
{
|
||||
$this->view->cases = $this->dao->select('t1.*,t2.lastRunResult')->from(TABLE_CASE)->alias('t1')
|
||||
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case')
|
||||
->where('t1.id')->in($this->post->caseIDList)
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->testtask->batchRun($from);
|
||||
$method = $from == 'testcase' ? 'browse' : 'cases';
|
||||
die(js::locate($this->createLink($from, $method, "productID=$productID"), 'parent'));
|
||||
}
|
||||
$this->app->loadLang('testcase');
|
||||
$this->testtask->setMenu($this->products, $productID);
|
||||
|
||||
$resultList = $this->lang->testcase->resultList;
|
||||
unset($resultList['n/a']);
|
||||
|
||||
$steps = $this->dao->select('t1.*')->from(TABLE_CASESTEP)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
|
||||
->where('t2.id')->in($this->post->caseIDList)
|
||||
->andWhere('t1.version=t2.version')
|
||||
->fetchGroup('case', 'id');
|
||||
|
||||
$this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
|
||||
$this->view->resultList = $resultList;
|
||||
$this->view->steps = $steps;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* View test results of a test run.
|
||||
*
|
||||
|
||||
@@ -20,6 +20,7 @@ $lang->testtask->linkCaseAB = "Link";
|
||||
$lang->testtask->unlinkCase = "Del";
|
||||
$lang->testtask->batchAssign = "Batch Assign";
|
||||
$lang->testtask->runCase = "Run";
|
||||
$lang->testtask->batchRun = "Batch Run";
|
||||
$lang->testtask->results = "Result";
|
||||
$lang->testtask->createBug = "Bug(+)";
|
||||
$lang->testtask->assign = 'Assign';
|
||||
|
||||
@@ -20,6 +20,7 @@ $lang->testtask->linkCaseAB = "关联";
|
||||
$lang->testtask->unlinkCase = "移除";
|
||||
$lang->testtask->batchAssign = "批量指派";
|
||||
$lang->testtask->runCase = "执行";
|
||||
$lang->testtask->batchRun = "批量执行";
|
||||
$lang->testtask->results = "结果";
|
||||
$lang->testtask->createBug = "提Bug";
|
||||
$lang->testtask->assign = '指派';
|
||||
|
||||
@@ -302,6 +302,73 @@ class testtaskModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch run case
|
||||
*
|
||||
* @param string $runCaseType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchRun($runCaseType = 'testcase')
|
||||
{
|
||||
$this->post->a();
|
||||
$runs = array();
|
||||
$caseIdList = array_keys($this->post->results);
|
||||
if($runCaseType == 'testtask') $runs = $this->dao->select('id, `case`')->from(TABLE_TESTRUN)->where('`case`')->in($caseIdList)->fetchPairs('case', 'id');
|
||||
|
||||
$stepGroups = $this->dao->select('t1.*')->from(TABLE_CASESTEP)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
|
||||
->where('t1.case')->in($caseIdList)
|
||||
->andWhere('t1.version=t2.version')
|
||||
->fetchGroup('case', 'id');
|
||||
|
||||
$now = helper::now();
|
||||
foreach($this->post->results as $caseID => $result)
|
||||
{
|
||||
$runID = isset($runs[$caseID]) ? $runs[$caseID] : 0;
|
||||
$dbSteps = $stepGroups[$caseID];
|
||||
$postSteps = $this->post->steps[$caseID];
|
||||
$postReals = $this->post->reals[$caseID];
|
||||
|
||||
$caseResult = $result ? $result : 'pass';
|
||||
$stepResults = array();
|
||||
foreach($dbSteps as $stepID => $step)
|
||||
{
|
||||
$step = array();
|
||||
$step['result'] = $caseResult == 'pass' ? $caseResult : $postSteps[$stepID];
|
||||
$step['real'] = $caseResult == 'pass' ? '' : $postReals[$stepID];
|
||||
$stepResults[$stepID] = $step;
|
||||
}
|
||||
|
||||
$result = new stdClass();
|
||||
$result->run = $runID;
|
||||
$result->case = $caseID;
|
||||
$result->version = $this->post->version[$caseID];
|
||||
$result->caseResult = $caseResult;
|
||||
$result->stepResults = serialize($stepResults);
|
||||
$result->lastRunner = $this->app->user->account;
|
||||
$result->date = $now;
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('lastRunner')->eq($this->app->user->account)->set('lastRunDate')->eq($now)->set('lastRunResult')->eq($caseResult)->where('id')->eq($caseID)->exec();
|
||||
|
||||
if($runID)
|
||||
{
|
||||
/* Update testRun's status. */
|
||||
if(!dao::isError())
|
||||
{
|
||||
$runStatus = $caseResult == 'blocked' ? 'blocked' : 'done';
|
||||
$this->dao->update(TABLE_TESTRUN)
|
||||
->set('lastRunResult')->eq($caseResult)
|
||||
->set('status')->eq($runStatus)
|
||||
->set('lastRunner')->eq($this->app->user->account)
|
||||
->set('lastRunDate')->eq($now)
|
||||
->where('id')->eq($runID)
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get results by runID or caseID
|
||||
*
|
||||
|
||||
69
module/testtask/view/batchrun.html.php
Normal file
69
module/testtask/view/batchrun.html.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* The batch edit view of testcase module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Congzhi Chen <congzhi@cnezsoft.com>
|
||||
* @package testcase
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<style type='text/css'>
|
||||
form p{margin:0px;}
|
||||
table td,th{border:1px solid #E4E4E4}
|
||||
table .table-1{border:0px; margin:0px;}
|
||||
table .table-1 td{border:0px;}
|
||||
</style>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table-1 fixed'>
|
||||
<caption><?php echo $lang->testtask->common . $lang->colon . $lang->testtask->batchRun;?></caption>
|
||||
<tr>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
<th class='w-pri'><?php echo $lang->priAB;?></th>
|
||||
<th class='w-100px'><?php echo $lang->testcase->module;?></th>
|
||||
<th><?php echo $lang->testcase->title;?></th>
|
||||
<th class='w-150px'><?php echo $lang->testcase->result?></th>
|
||||
<th><?php echo $lang->testcase->stepDesc . '/' . $lang->testcase->stepExpect?></th>
|
||||
</tr>
|
||||
<?php foreach($cases as $caseID => $case):?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo $case->id . html::hidden("version[$case->id]", $case->version)?></td>
|
||||
<td><?php echo $lang->testcase->priList[$case->pri]?></td>
|
||||
<td align='left'><?php echo $moduleOptionMenu[$case->module]?></td>
|
||||
<td align='left'><?php echo $case->title?></td>
|
||||
<td><?php echo html::radio("results[$case->id]", $resultList, 'pass', "onchange='showAction(this.value,\".action$caseID\")'")?></td>
|
||||
<td>
|
||||
<table class='table-1'>
|
||||
<?php $i = 1;?>
|
||||
<?php foreach($steps[$caseID] as $stepID => $step):?>
|
||||
<tr>
|
||||
<td align='left' width='50%'><?php echo "<span title='$step->desc'>" . $i . "、" . $step->desc . '</span>'?></td>
|
||||
<td align='left' width='50%'><?php echo "<span title='$step->expect'>" . $lang->testcase->stepExpect . ":" . $step->expect . '</span>'?></td>
|
||||
<td class='hidden action<?php echo $caseID?>'><?php echo html::select("steps[$caseID][$stepID]", $lang->testcase->resultList, 'pass') . html::input("reals[$caseID][$stepID]", '', "class='text-2'");?></td>
|
||||
</tr>
|
||||
<?php $i++?>
|
||||
<?php endforeach?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr><td colspan='6' class='a-center'><?php echo html::submitButton();?></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<script type='text/javascript'>
|
||||
function showAction(value, obj)
|
||||
{
|
||||
if(value == 'pass')
|
||||
{
|
||||
$(obj).addClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(obj).removeClass('hidden');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -95,7 +95,8 @@ var moduleID = '<?php echo $moduleID;?>';
|
||||
<?php endif;?>
|
||||
<?php if(common::hasPriv('testtask', 'batchAssign')):?>
|
||||
<?php echo html::select('assignedTo', $users);?>
|
||||
<input class='button-s' value="<?php echo $lang->testtask->batchAssign; ?>" type="button" onclick="casesform.action='<?php echo $this->inLink('batchAssign', "taskID=$task->id");?>';casesform.submit();">
|
||||
<input class='button-s' value="<?php echo $lang->testtask->batchAssign; ?>" type="button" onclick="casesform.action='<?php echo inLink('batchAssign', "taskID=$task->id");?>';casesform.submit();">
|
||||
<input class='button-s' value="<?php echo $lang->testtask->batchRun; ?>" type="button" onclick="casesform.action='<?php echo inLink('batchRUN', "productID=$productID&orderBy=id_desc&from=testtask");?>';casesform.submit();">
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php echo $pager->show();?>
|
||||
|
||||
Reference in New Issue
Block a user