* change the param of runcase.
This commit is contained in:
@@ -319,35 +319,20 @@ class testtask extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function runCase($runID, $extras = '')
|
||||
public function runCase($runID, $caseID = 0, $version = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->testtask->createResult($runID, $extras);
|
||||
$this->testtask->createResult($runID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
echo js::reload('parent');
|
||||
die(js::closeWindow());
|
||||
}
|
||||
|
||||
if(!$caseID) $run = $this->testtask->getRunById($runID);
|
||||
if($caseID) $run->case = $this->loadModel('testcase')->getById($caseID, $version);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
$this->view->run = $run;
|
||||
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
+12
-17
@@ -198,15 +198,20 @@ 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, $extras)
|
||||
public function createResult($runID = 0)
|
||||
{
|
||||
/* Compute the test result. */
|
||||
$caseResult = 'pass';
|
||||
if(!$this->post->passall)
|
||||
/* Compute the test result.
|
||||
*
|
||||
* 1. if there result in the post, use it.
|
||||
* 2. if no result, set default is pass.
|
||||
* 3. then check the steps to compute result.
|
||||
*
|
||||
* */
|
||||
$caseResult = $this->post->result ? $this->post->result : 'pass';
|
||||
if(isset($_POST['passall']) and $this->post->passall == false)
|
||||
{
|
||||
if($this->post->steps)
|
||||
{
|
||||
@@ -219,10 +224,6 @@ class testtaskModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$caseResult = 'fail';
|
||||
}
|
||||
}
|
||||
|
||||
/* Create result of every step. */
|
||||
@@ -240,12 +241,6 @@ class testtaskModel extends model
|
||||
$stepResults = array();
|
||||
}
|
||||
|
||||
/* 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')
|
||||
@@ -253,12 +248,12 @@ class testtaskModel extends model
|
||||
->add('caseResult', $caseResult)
|
||||
->setForce('stepResults', serialize($stepResults))
|
||||
->add('date', $now)
|
||||
->remove('steps,reals,passall')
|
||||
->remove('steps,reals,passall,result')
|
||||
->get();
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('lastRun')->eq($now)->set('lastResult')->eq($caseResult)->where('id')->eq($this->post->case)->exec();
|
||||
|
||||
if(!isset($caseID))
|
||||
if($runID)
|
||||
{
|
||||
/* Update testRun's status. */
|
||||
if(!dao::isError())
|
||||
|
||||
@@ -39,17 +39,18 @@
|
||||
<?php
|
||||
if(empty($run->case->steps))
|
||||
{
|
||||
echo html::submitButton($lang->testtask->pass, "onclick=$('#passall').val(1)");
|
||||
echo html::submitButton($lang->testtask->fail, "onclick=$('#passall').val(0)");
|
||||
echo html::submitButton($lang->testtask->pass, "onclick=$('#result').val('pass')");
|
||||
echo html::submitButton($lang->testtask->fail, "onclick=$('#result').val('fail')");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::submitButton();
|
||||
echo html::submitButton($lang->testtask->passAll, "onclick=$('#passall').val(1)");
|
||||
}
|
||||
echo html::hidden('case', $run->case->id);
|
||||
echo html::hidden('case', $run->case->id);
|
||||
echo html::hidden('version', $run->case->version);
|
||||
echo html::hidden('passall', 0);
|
||||
if($run->case->steps) echo html::hidden('passall', 0);
|
||||
if(!$run->case->steps) echo html::hidden('result', '');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user