Finish task#3277 调整测试报告,cost:4 left:0

This commit is contained in:
wangyidong
2017-10-25 10:10:31 +08:00
parent 5e3cc44e86
commit f560cb7091
9 changed files with 58 additions and 46 deletions
-5
View File
@@ -247,11 +247,6 @@ $config->bug->datatable->fieldList['browser']['fixed'] = 'no';
$config->bug->datatable->fieldList['browser']['width'] = '80';
$config->bug->datatable->fieldList['browser']['required'] = 'no';
$config->bug->datatable->fieldList['found']['title'] = 'found';
$config->bug->datatable->fieldList['found']['fixed'] = 'no';
$config->bug->datatable->fieldList['found']['width'] = '80';
$config->bug->datatable->fieldList['found']['required'] = 'no';
$config->bug->datatable->fieldList['mailto']['title'] = 'mailto';
$config->bug->datatable->fieldList['mailto']['fixed'] = 'no';
$config->bug->datatable->fieldList['mailto']['width'] = '100';
+4 -12
View File
@@ -128,12 +128,8 @@ class testreport extends control
$builds = array();
if($task->build == 'trunk')
{
$stories = $this->story->getProjectStories($project->id);
$bugs = $this->testreport->getBugs4Test('trunk', $productID, $project->begin, date('Y-m-d', strtotime($task->begin) - 24 * 3600));
foreach($stories as $id => $story)
{
if($story->product != $task->product) unset($stories[$id]);
}
echo js::alert($this->lang->testreport->errorTrunk);
die(js::locate('back'));
}
else
{
@@ -264,12 +260,8 @@ class testreport extends control
$builds = array();
if($task->build == 'trunk')
{
$stories = $this->story->getProjectStories($project->id);
$bugs = $this->testreport->getBugs4Test('trunk', $report->product, $project->begin, date('Y-m-d', strtotime($task->begin) - 24 * 3600));
foreach($stories as $id => $story)
{
if($story->product != $task->product) unset($stories[$id]);
}
echo js::alert($this->lang->testreport->errorTrunk);
die(js::locate('back'));
}
else
{
+11 -1
View File
@@ -54,8 +54,18 @@ $lang->testreport->bugCreateByCaseRate = 'Bug Created in Case Rate (Bugs created
$lang->testreport->caseSummary = ' <strong>%s</strong> cases in total, <strong>%s</strong> cases performed, <strong>%s</strong> results generated, <strong>%s</strong> cases failed.';
$lang->testreport->buildSummary = ' Tested <strong>%s</strong> build.';
$lang->testreport->bugSummary = '<strong>%s</strong> Bug(s) generated in total and <strong>%s</strong> Bug(s) remained unresolved. Confirmed bug rate(bug resolution is resolved or delayedg status is resolved or closed): <strong>%s</strong>,Bug created in case rate(Bugs created in cases / Newly generated bugs): <strong>%s</strong>';
$lang->testreport->confirmDelete = 'Do you want tot delete this report?';
$lang->testreport->moreNotice = 'More features can be extended with reference to the ZenTao extension mechanism, or you can contact us for customization.';
$lang->testreport->exportNotice = "Export By <a href='http://www.zentao.net' target='_blank' style='color:grey'>ZenTaoPMS</a>";
$lang->testreport->noReport = "The report has not yet been generated. Please check it later.";
$lang->testreport->foundBugTip = "openBuild in builds and create time in test time within the range of Bug number.";
$lang->testreport->legacyBugTip = "The Bug state is activated, or the settling time of Bug is at the end of the test.";
$lang->testreport->fromCaseBugTip= "Bug created after failure of use case in test time range.";
$lang->testreport->errorTrunk = "The trunk version cannot create a test report. Please modify the associated version!";
$lang->testreport->bugSummary = <<<EOD
<strong>%s</strong> Bug(s) generated in total <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->foundBugTip}'><i class='icon-warning-sign'></i></a>,
<strong>%s</strong> Bug(s) remained unresolve <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->legacyBugTip}'><i class='icon-warning-sign'></i></a>,
<strong>%s</strong> Bug(s) failure of case <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->fromCaseBugTip}'><i class='icon-warning-sign'></i></a>.
Confirmed bug rate(bug resolution is resolved or delayedg status is resolved or closed): <strong>%s</strong>,Bug created in caserate(Bugs created in cases / Newly generated bugs): <strong>%s</strong>'
EOD;
+11 -1
View File
@@ -54,8 +54,18 @@ $lang->testreport->bugCreateByCaseRate = '用例发现Bug率 (用例创建的Bug
$lang->testreport->caseSummary = '共有<strong>%s</strong>个用例,共执行<strong>%s</strong>个用例,产生了<strong>%s</strong>个结果,失败的用例有<strong>%s</strong>个。';
$lang->testreport->buildSummary = '共测试了<strong>%s</strong>个版本。';
$lang->testreport->bugSummary = '共产生<strong>%s</strong>个Bug,遗留<strong>%s</strong>个Bug。有效Bug率(方案为已解决或延期 / 状态为已解决或已关闭):<strong>%s</strong>,用例发现Bug率(用例创建的Bug / 时间区间中新增的Bug):<strong>%s</strong>';
$lang->testreport->confirmDelete = '是否删除该报告?';
$lang->testreport->moreNotice = '更多功能可以参考禅道扩展机制进行扩展,也可以联系我们进行定制。';
$lang->testreport->exportNotice = "由<a href='http://www.zentao.net' target='_blank' style='color:grey'>禅道项目管理软件</a>导出";
$lang->testreport->noReport = "报表还没有生成,请稍候查看。";
$lang->testreport->foundBugTip = "影响版本在测试轮次内,并且创建时间在测试时间范围内产生的Bug数。";
$lang->testreport->legacyBugTip = "Bug状态是激活,或Bug的解决时间在测试结束时间之后。";
$lang->testreport->fromCaseBugTip= "测试时间范围内,用例执行失败后创建的Bug";
$lang->testreport->errorTrunk = "主干版本不能创建测试报告,请修改关联版本!";
$lang->testreport->bugSummary = <<<EOD
共发现<strong>%s</strong>个Bug <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->foundBugTip}'><i class='icon-warning-sign'></i></a>,
遗留<strong>%s</strong>个Bug <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->legacyBugTip}'><i class='icon-warning-sign'></i></a>。
用例执行产生<strong>%s</strong>个Bug <a data-toggle='tooltip' class='text-warning' title='{$lang->testreport->fromCaseBugTip}'><i class='icon-warning-sign'></i></a>。
有效Bug率(方案为已解决或延期 / 状态为已解决或已关闭):<strong>%s</strong>,用例发现Bug率(用例创建的Bug / 发现Bug数):<strong>%s</strong>
EOD;
+24 -18
View File
@@ -93,8 +93,8 @@ class testreportModel extends model
$data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_TESTREPORT)->data($data)->autocheck()
->batchCheck($this->config->testreport->create->requiredFields, 'notempty')
->batchCheck('start,end', 'notempty')
->check('end', 'ge', $data->start)
->batchCheck('begin,end', 'notempty')
->check('end', 'ge', $data->begin)
->exec();
if(dao::isError()) return false;
$reportID = $this->dao->lastInsertID();
@@ -125,8 +125,8 @@ class testreportModel extends model
$data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_TESTREPORT)->data($data)->autocheck()
->batchCheck($this->config->testreport->edit->requiredFields, 'notempty')
->batchCheck('start,end', 'notempty')
->check('end', 'ge', $data->start)
->batchCheck('begin,end', 'notempty')
->check('end', 'ge', $data->begin)
->where('id')->eq($reportID)
->exec();
if(dao::isError()) return false;
@@ -186,10 +186,25 @@ class testreportModel extends model
*/
public function getBugInfo($tasks, $productIdList, $begin, $end, $builds)
{
$bugsByTask = $this->dao->select('*')->from(TABLE_BUG)->where('testtask')->in(array_keys($tasks))->andWhere('testtask')->ne(0)->andWhere('`case`')->ne(0)->andWhere('deleted')->eq(0)->fetchAll('id');
$allNewBugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->in($productIdList)->andWhere('openedDate')->ge($begin)->andWhere('openedDate')->le("$end 23:59:59")->andWhere('deleted')->eq(0)->fetchAll();
$foundBugs = array();
$legacyBugs = array();
$byCaseNum = 0;
$buildIdList = array_keys($builds);
$taskIdList = array_keys($tasks);
foreach($allNewBugs as $bug)
{
if(!array_diff(explode(',', $bug->openedBuild), $buildIdList))
{
$foundBugs[$bug->id] = $bug;
if($bug->status == 'active' OR $bug->resolvedDate > "$end 23:59:59") $legacyBugs[$bug->id] = $bug;
}
if($bug->case and !empty($bug->testtask) and in_array($bug->testtask, $taskIdList)) $byCaseNum ++;
}
$severityGroups = $statusGroups = $openedByGroups = $resolvedByGroups = $resolutionGroups = $moduleGroups = $typeGroups = array();
$resolvedBugs = 0;
foreach($bugsByTask as $bug)
foreach($foundBugs as $bug)
{
$severityGroups[$bug->severity] = isset($severityGroups[$bug->severity]) ? $severityGroups[$bug->severity] + 1 : 1;
$typeGroups[$bug->type] = isset($typeGroups[$bug->type]) ? $typeGroups[$bug->type] + 1 : 1;
@@ -201,20 +216,11 @@ class testreportModel extends model
if($bug->status == 'resolved' or $bug->status == 'closed') $resolvedBugs ++;
}
$newBugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->in($productIdList)->andWhere('openedDate')->ge($begin)->andWhere('openedDate')->le("$end 23:59:59")->andWhere('deleted')->eq(0)->fetchAll();
$legacyBugs = array();
$byCaseNum = 0;
$buildIdList = array_keys($builds) + array('trunk' => 'trunk');
foreach($newBugs as $bug)
{
if(!array_diff(explode(',', $bug->openedBuild), $buildIdList) and ($bug->status == 'active' OR $bug->resolvedDate > "$end 23:59:59")) $legacyBugs[$bug->id] = $bug;
if($bug->case) $byCaseNum ++;
}
$bugInfo['foundBugs'] = count($foundBugs);
$bugInfo['legacyBugs'] = $legacyBugs;
$bugInfo['countBugByTask'] = count($bugsByTask);
$bugInfo['countBugByTask'] = $byCaseNum;
$bugInfo['bugConfirmedRate'] = empty($resolvedBugs) ? 0 : round((zget($resolutionGroups, 'fixed', 0) + zget($resolutionGroups, 'postponed', 0)) / $resolvedBugs * 100, 2);
$bugInfo['bugCreateByCaseRate'] = empty($byCaseNum) ? 0 : round($byCaseNum / count($newBugs) * 100, 2);
$bugInfo['bugCreateByCaseRate'] = empty($byCaseNum) ? 0 : round($byCaseNum / count($foundBugs) * 100, 2);
$this->app->loadLang('bug');
$users = $this->loadModel('user')->getPairs('noclosed|noletter|nodeleted');
+2 -2
View File
@@ -68,8 +68,8 @@
<?php
echo '<p>' . $storySummary . '</p>';
echo '<p>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</p>';
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['countBugByTask'], count($legacyBugs), $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']);
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']);
?>
</td>
</tr>
+2 -2
View File
@@ -63,8 +63,8 @@
<?php
echo '<p>' . $storySummary . '</p>';
echo '<p>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</p>';
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['countBugByTask'], count($legacyBugs), $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']);
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']);
?>
</td>
</tr>
+2 -2
View File
@@ -84,8 +84,8 @@
<?php
echo '<p>' . $storySummary . '</p>';
echo '<p>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</p>';
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['countBugByTask'], count($legacyBugs), $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']);
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']);
?>
</td>
</tr>
+2 -3
View File
@@ -134,14 +134,13 @@ class testtask extends control
$productID = $productID ? $productID : key($products);
$projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs('id');
$builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('project')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs('id');
$builds = array('trunk' => $this->lang->trunk) + $builds;
}
/* Create testtask from testtask of test.*/
if($projectID == 0)
{
$projects = $this->product->getProjectPairs($productID, $branch = 0, $params = 'nodeleted');
$builds = $this->loadModel('build')->getProductBuildPairs($productID);
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
}
/* Set menu. */
@@ -442,7 +441,7 @@ class testtask extends control
$this->view->task = $task;
$this->view->projects = $this->product->getProjectPairs($productID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = '');
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = 'notrunk');
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', $task->owner);
$this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote');