+ finish task#573,task#575

This commit is contained in:
chencongzhi520@gmail.com
2011-10-16 09:21:30 +00:00
parent f433f23308
commit a5fe7d91d0
7 changed files with 64 additions and 22 deletions
+6 -5
View File
@@ -272,11 +272,12 @@ class testcase extends control
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testcase->view;
$this->view->case = $case;
$this->view->productName = $this->products[$productID];
$this->view->modulePath = $this->tree->getParents($case->module);
$this->view->users = $this->user->getPairs('noletter');
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
$this->view->case = $case;
$this->view->productName = $this->products[$productID];
$this->view->modulePath = $this->tree->getParents($case->module);
$this->view->users = $this->user->getPairs('noletter');
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
$this->view->currentVersion = $version;
$this->display();
}
+1
View File
@@ -22,6 +22,7 @@ function browseBySearch(active)
$(document).ready(function()
{
$("a.runcase").colorbox({width:900, height:600, iframe:true, transition:'none'});
$('#' + browseType + 'Tab').addClass('active');
$('#module' + moduleID).addClass('active');
});
+4
View File
@@ -0,0 +1,4 @@
$(document).ready(function()
{
$(".runcase").colorbox({width:900, height:600, iframe:true, transition:'none'});
})
+2 -1
View File
@@ -61,7 +61,7 @@ var moduleID = '<?php echo $moduleID;?>';
<th class='w-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->typeAB);?></th>
<th class='w-user'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='w-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-80px {sorter:false}'><?php echo $lang->actions;?></th>
<th class='w-100px {sorter:false}'><?php echo $lang->actions;?></th>
<?php endif;?>
</tr>
<?php foreach($cases as $case):?>
@@ -81,6 +81,7 @@ var moduleID = '<?php echo $moduleID;?>';
<?php
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
common::printLink('testtask', 'runCase', "runID=0&extras=caseID=$case->id", $this->app->loadLang('testtask')->testtask->runCase, '', 'class="runcase"');
?>
</td>
<?php endif;?>
+8 -3
View File
@@ -19,6 +19,7 @@
$browseLink = $app->session->caseList != false ? $app->session->caseList : $this->createLink('testcase', 'browse', "productID=$case->product");
if(!$case->deleted)
{
common::printLink('testtask', 'runCase', "runID=0&extras=version=$currentVersion,caseID=$case->id", $this->app->loadLang('testtask')->testtask->runCase, '', 'class="runcase"');
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'create', "productID=$case->product&moduleID=$case->module&testcaseID=$case->id", $lang->copy);
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
@@ -32,10 +33,14 @@
<tr valign='top'>
<td>
<table class='table-1 colored'>
<fieldset>
<legend><?php echo $lang->testcase->precondition;?></legend>
<?php echo $case->precondition;?>
</fieldset>
<tr class='colhead'>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></td>
<th class='w-p70'><?php echo $lang->testcase->stepDesc;?></td>
<th><?php echo $lang->testcase->stepExpect;?></td>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
<th class='w-p70'><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
</tr>
<?php
foreach($case->steps as $stepID => $step)
+23 -3
View File
@@ -315,20 +315,40 @@ class testtask extends control
* Run case.
*
* @param int $runID
* @param String $extras others params, forexample, caseID=10, version=3
* @access public
* @return void
*/
public function runCase($runID)
public function runCase($runID, $extras = '')
{
if(!empty($_POST))
{
$this->testtask->createResult($runID);
$this->testtask->createResult($runID, $extras);
if(dao::isError()) die(js::error(dao::getError()));
echo js::reload('parent');
die(js::closeWindow());
}
$this->view->run = $this->testtask->getRunById($runID);
/* Pares the extras */
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
parse_str($extras);
if(!isset($caseID))
{
$this->view->run = $this->testtask->getRunById($runID);
}
else
{
if(isset($version))
{
$this->view->run->case = $this->loadModel('testcase')->getById($caseID, $version);
$this->view->run->case->version = $version;
}
else
$this->view->run->case = $this->loadModel('testcase')->getById($caseID);
}
die($this->display());
}
+20 -10
View File
@@ -197,10 +197,11 @@ class testtaskModel extends model
* Create test result
*
* @param int $runID
* @param string $extras others params, forexample, caseID=10
* @access public
* @return void
*/
public function createResult($runID)
public function createResult($runID, $extras)
{
/* Compute the test result. */
$caseResult = 'pass';
@@ -224,6 +225,12 @@ class testtaskModel extends model
$stepResults[$stepID] = $step;
}
/* Pares the extras */
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
parse_str($extras);
if(isset($caseID)) $runID = 0;
/* Insert into testResult table. */
$now = helper::now();
$result = fixer::input('post')
@@ -235,16 +242,19 @@ class testtaskModel extends model
->get();
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
/* Update testRun's status. */
if(!dao::isError())
if(!isset($caseID))
{
$runStatus = $caseResult == 'blocked' ? 'blocked' : 'done';
$this->dao->update(TABLE_TESTRUN)
->set('lastResult')->eq($caseResult)
->set('status')->eq($runStatus)
->set('lastRun')->eq($now)
->where('id')->eq($runID)
->exec();
/* Update testRun's status. */
if(!dao::isError())
{
$runStatus = $caseResult == 'blocked' ? 'blocked' : 'done';
$this->dao->update(TABLE_TESTRUN)
->set('lastResult')->eq($caseResult)
->set('status')->eq($runStatus)
->set('lastRun')->eq($now)
->where('id')->eq($runID)
->exec();
}
}
}