+ add pri, keywords, stage fields to case module.

This commit is contained in:
wangchunsheng
2010-03-27 13:44:07 +00:00
parent 7a64c0e5c8
commit b659b7ca54
9 changed files with 116 additions and 34 deletions

View File

@@ -7,8 +7,9 @@ ADD `scriptedBy` VARCHAR( 30 ) NOT NULL AFTER `executeType` ,
ADD `scriptedDate` DATE NOT NULL AFTER `scriptedBy` ,
ADD `scriptStatus` VARCHAR( 30 ) NOT NULL AFTER `scriptedDate` ,
ADD `scriptLocation` VARCHAR( 255 ) NOT NULL AFTER `scriptStatus` ,
ADD `linkCase` MEDIUMINT UNSIGNED NOT NULL AFTER `scriptLocation` ;
ALTER TABLE `zt_case` ADD `scope` VARCHAR( 30 ) NOT NULL ;
ADD `linkCase` VARCHAR( 255 ) NOT NULL AFTER `scriptLocation` ;
ALTER TABLE `zt_case` ADD `stage` VARCHAR( 255 ) NOT NULL ;
-- 2010-03-23 userQuery表。
CREATE TABLE `zentao`.`zt_userQuery` (

View File

@@ -3,20 +3,24 @@ global $lang;
$config->testcase->search['module'] = 'testcase';
$config->testcase->search['fields']['id'] = $lang->testcase->id;
$config->testcase->search['fields']['title'] = $lang->testcase->title;
$config->testcase->search['fields']['keywords'] = $lang->testcase->keywords;
$config->testcase->search['fields']['openedBy'] = $lang->testcase->openedBy;
$config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedBy;
$config->testcase->search['fields']['status'] = $lang->testcase->status;
$config->testcase->search['fields']['pri'] = $lang->testcase->pri;
$config->testcase->search['fields']['type'] = $lang->testcase->type;
$config->testcase->search['fields']['stage'] = $lang->testcase->stage;
$config->testcase->search['fields']['openedDate'] = $lang->testcase->openedDate;
$config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEditedDate;
$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']['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);
$config->testcase->search['params']['pri'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->testcase->priList);
$config->testcase->search['params']['type'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->testcase->typeList);
$config->testcase->search['params']['stage'] = array('operator' => 'include', 'control' => 'select', 'values' => $lang->testcase->stageList);
$config->testcase->create->requiredFields = 'title';
$config->testcase->edit->requiredFields = 'title';
$config->testcase->create->requiredFields = 'title,type';
$config->testcase->edit->requiredFields = 'title,type';

View File

@@ -40,6 +40,14 @@ $lang->testcase->lastEditedDate = '最后修改日期';
$lang->testcase->version = '用例版本';
$lang->testcase->result = '测试结果';
$lang->testcase->real = '实际情况';
$lang->testcase->keywords = '关键词';
$lang->testcase->executeType = '执行方式';
$lang->testcase->scriptedBy = '由谁编写';
$lang->testcase->scriptedDate = '编写日期';
$lang->testcase->scriptedStatus = '脚本状态';
$lang->testcase->scriptedLocation = '脚本位置';
$lang->testcase->linkCase = '相关用例';
$lang->testcase->stage = '适用阶段';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字所以无法定义该模块为case只能使用testcase但表还是使用的case。
$lang->testcase->stepID = '编号';
@@ -102,6 +110,14 @@ $lang->testcase->typeList['install'] = '安装部署';
$lang->testcase->typeList['security'] = '安全相关';
$lang->testcase->typeList['other'] = '其他';
$lang->testcase->stageList[''] = '';
$lang->testcase->stageList['unittest'] = '单元测试阶段';
$lang->testcase->stageList['feature'] = '功能测试阶段';
$lang->testcase->stageList['intergrate'] = '集成测试阶段';
$lang->testcase->stageList['system'] = '系统测试阶段';
$lang->testcase->stageList['smoke'] = '冒烟测试阶段';
$lang->testcase->stageList['bvt'] = '版本验证阶段';
$lang->testcase->statusList[''] = '';
$lang->testcase->statusList['normal'] = '正常';
$lang->testcase->statusList['blocked'] = '被阻塞';

View File

@@ -47,8 +47,8 @@ class testcaseModel extends model
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->remove('steps,expects')
->setDefault('story', 0)
->stripTags('title')
->specialChars('steps')
->specialChars('title')
->join('stage', ',')
->get();
$this->dao->insert(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->exec();
if(!$this->dao->isError())
@@ -80,7 +80,8 @@ class testcaseModel extends model
{
$case = $this->dao->findById($caseID)->from(TABLE_CASE)->fetch();
foreach($case as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $case->$key = '';
if($case->story) $case->storyTitle = $this->dao->findById($case->story)->from(TABLE_STORY)->fetch('title');
if($case->story) $case->storyTitle = $this->dao->findById($case->story)->from(TABLE_STORY)->fetch('title');
if($case->linkCase) $case->linkCaseTitles = $this->dao->select('id,title')->from(TABLE_CASE)->where('id')->in($case->linkCase)->fetchPairs();
if($version == 0) $version = $case->version;
$case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->fetchAll();
$case->files = $this->loadModel('file')->getByObject('case', $caseID);
@@ -128,7 +129,8 @@ class testcaseModel extends model
->add('version', $version)
->setIF($this->post->story != false and $this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->setDefault('story', 0)
->stripTags('title')
->specialChars('title')
->join('stage', ',')
->remove('comment,steps,expects')
->get();
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();

View File

@@ -29,22 +29,34 @@
<caption><?php echo $lang->testcase->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->testcase->lblProductAndModule;?></th>
<td class='a-left'>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-3'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->type;?></th>
<td><?php echo html::select('type', $lang->testcase->typeList, 'feature', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->stage;?></th>
<td><?php echo html::select('stage[]', $lang->testcase->stageList, '', "class='select-3' multiple='multiple'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->pri;?></th>
<td><?php echo html::select('pri', $lang->testcase->priList, '', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->lblStory;?></th>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, '', 'class=select-3');?></span></td>
<td><span id='storyIdBox'><?php echo html::select('story', $stories, '', 'class=select-3');?></span></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->title;?></th>
<td class='a-left'><?php echo html::input('title', '', "class='text-1'");?></td>
<td><?php echo html::input('title', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->steps;?></th>
<td class='a-left'>
<td>
<table class='w-p90'>
<tr class='colhead'>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
@@ -71,12 +83,10 @@
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->lblTypeAndPri;?></th>
<td class='a-left'>
<?php echo html::select('type', (array)$lang->testcase->typeList, '', 'class=select-2');?>
<?php echo html::select('pri', (array)$lang->testcase->priList, '', 'class=select-2');?>
</td>
<th class='rowhead'><?php echo $lang->testcase->keywords;?></th>
<td><?php echo html::input('keywords', '', "class='text-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?> </td>
</tr>

View File

@@ -101,10 +101,18 @@
<td class='rowhead'><?php echo $lang->testcase->module;?></td>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "class='select-1'");?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, $case->story, 'class=select-1');?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td><?php echo html::select('type', (array)$lang->testcase->typeList, $case->type, 'class=select-1');?>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->stage;?></th>
<td><?php echo html::select('stage[]', $lang->testcase->stageList, $case->stage, "class='select-1' multiple='multiple'");?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo html::select('pri', (array)$lang->testcase->priList, $case->pri, 'class=select-1');?>
@@ -114,8 +122,12 @@
<td><?php echo html::select('status', (array)$lang->testcase->statusList, $case->status, 'class=select-1');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, $case->story, 'class=select-1');?></span></td>
<td class='rowhead'><?php echo $lang->testcase->keywords;?></td>
<td><?php echo html::input('keywords', $case->keywords, 'class=text-1');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->linkCase;?></td>
<td><?php echo html::input('linkCase', $case->linkCase, 'class=text-1');?></td>
</tr>
</table>
</fieldset>

View File

@@ -30,8 +30,9 @@
CASE #<?php echo $case->id . $lang->colon . $case->title;?>
<div class='f-right'>
<?php
$browseLink = $app->session->caseList != false ? $app->session->caseList : $this->createLink('testcase', 'browse', "productID=$case->product");
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'browse', "productID=$case->product", $lang->testcase->buttonToList);
echo html::a($browseLink, $lang->goback);
?>
</div>
</div>
@@ -68,15 +69,12 @@
-->
<?php include '../../common/view/action.html.php';?>
<fieldset>
<legend><?php echo $lang->testcase->legendAction;?></legend>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'browse', "productID=$case->product", $lang->testcase->buttonToList);
?>
</div>
</fieldset>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
echo html::a($browseLink, $lang->goback);
?>
</div>
</div>
</div>
<div class='yui-b'>
@@ -99,10 +97,34 @@
?>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='nobr'>
<?php
if(isset($case->storyTitle)) echo html::a($this->createLink('story', 'view', "storyID=$case->story"), "#$case->story:$case->storyTitle");
?>
</td>
</tr>
<tr>
<td class='rowhead w-p20'><?php echo $lang->testcase->type;?></td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
</tr>
<tr>
<td class='rowhead w-p20'><?php echo $lang->testcase->stage;?></td>
<td>
<?php
if($case->stage)
{
$stags = explode(',', $case->stage);
foreach($stags as $stage)
{
isset($lang->testcase->stageList[$stage]) ? print($lang->testcase->stageList[$stage]) : print($stage);
echo "<br />";
}
}
?>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo $case->pri;?></td>
@@ -112,10 +134,20 @@
<td><?php echo $lang->testcase->statusList[$case->status];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='nobr'>
<td class='rowhead'><?php echo $lang->testcase->keywords;?></td>
<td><?php echo $case->keywords;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->linkCase;?></td>
<td>
<?php
if(isset($case->storyTitle)) echo html::a($this->createLink('story', 'view', "storyID=$case->story"), "#$case->story:$case->storyTitle");
if(isset($case->linkCaseTitles))
{
foreach($case->linkCaseTitles as $linkCaseID => $linkCaseTitle)
{
echo html::a($this->createLink('case', 'view', "caseID=$linkCaseID"), "#$linkCaseID $linkCaseTitle", '_blank') . '<br />';
}
}
?>
</td>
</tr>

View File

@@ -91,6 +91,8 @@ class testtask extends control
/* 查看一个task。*/
public function view($taskID)
{
$this->app->loadLang('testcase');
/* 获取task和产品信息并设置菜单。*/
$task = $this->testtask->getById($taskID);
$productID = $task->product;
@@ -164,11 +166,14 @@ class testtask extends control
$this->locate(inlink('view', "taskID=$taskID"));
}
$this->session->set('caseList', $this->app->getURI(true));
/* 获得task信息。*/
$task = $this->testtask->getById($taskID);
$productID = common::saveProductState($task->product, key($this->products));
/* 构造搜索表单。*/
$this->loadModel('testcase');
$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);

View File

@@ -85,7 +85,7 @@ function checkall(checker)
<tr>
<th class='w-20px'><nobr><?php echo $lang->testcase->id;?></nobr></th>
<th><?php echo $lang->testcase->pri;?></th>
<th class='w-p40'><?php echo $lang->testcase->title;?></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><?php echo $lang->testtask->lastRun;?></th>