TestLink增加在执行用例界面的历史相关bug功能

发表于:2015-7-01 10:51  作者:燃灯胡同   来源:51Testing软件测试网采编

字体: | 上一篇 | 下一篇 |我要投稿 | 推荐标签: 软件测试工具 TestLink 测试管理工具

  在之前配置TestLink的过程中,考虑在执行的过程中,显示该用例关联过的缺陷,作为测试执行参考,需要在execSetResults.php里面增加部分代码,代码如下:
//blew function is added by hengleiwang 2013/3/21
/*
Add this function to list all of them bugs that have been related to this testcases
*/
function exec_get_testcase_related_bugs(&$db,&$bug_interface,$tcversionSet)
{
$bugs = null;
$bugs = get_bugs_for_testcase($db,$bug_interface,$tcversionSet);
return $bugs;
}
$gui->case_related_bug = exec_get_testcase_related_bugs($db,$g_bugInterface,$gui->tcversionSet);
if (count($gui->case_related_bug) == 0)
{
$gui->case_related_bug = null;
}
inc_exec_controls.tpl
{*input the code here for test cases related bugs;*---by henrywang}
{* Execution Bugs (if any) *}
{if isset($gui->case_related_bug)}
<div class="exec_history_title">
关联到这个用例的缺陷
</div>
<table style="width:95%;">
<tr style="background-color: {$bg_color}" >
<td colspan="{$my_colspan}" style="align:center;">
{*BUGID 3587*}
{include file="inc_show_bug_table_without_del.tpl"
bugs_map=$gui->case_related_bug
}
</td>
</tr>
{/if}
</table>
{*end the input*------by henrywang}
inc_show_bug_table_without_del.tpl
{*
Testlink Open Source Project - http://testlink.sourceforge.net/
$Id: inc_show_bug_table.tpl,v 1.10 2010/07/09 11:41:15 mx-julian Exp $
rev :
20100709 - Julian - show greyed delete icon if delete is not allowed
20070304 - franciscom - added single quotes on bug_id on deleteBug_onClick() call
message improvement
added title on delete image.
*}
{* -------------------------------------------------------------------------------------- *}
{* Manage missing arguments                                                               *}
{if !isset($tableClassName) }
{assign var="tableClassName"  value="simple"}
{/if}
{if !isset($tableStyles) }
{assign var="tableStyles"  value="font-size:12px"}
{/if}
{* -------------------------------------------------------------------------------------- *}
<table class="simple">
<tr>
<th style="text-align:left">{lang_get s='build'}</th>
<th style="text-align:left">{lang_get s='caption_bugtable'}</th>
<th style="text-align:left">&nbsp;</th>
</tr>
{foreach from=$bugs_map key=bug_id item=bug_elem}
<tr>
<td>{$bug_elem.build_name|escape}</td>
<td>{$bug_elem.link_to_bts}</td>
</tr>
{/foreach}
</table>
exec.inc.php
/*
* get bugs for the testcase
* added by hengleiwang 2013/3/21
*/
function get_bugs_for_testcase($db,&$bug_interface,$tcversionSet)
{
$tables['execution_bugs'] = DB_TABLE_PREFIX . 'execution_bugs';
$tables['executions'] = DB_TABLE_PREFIX . 'executions';
$tables['builds'] = DB_TABLE_PREFIX . 'builds';
$bug_list=array();
$sql = "SELECT bug_id,builds.name AS build_name " .
"FROM {$tables['execution_bugs']}, {$tables['executions']} executions, " .
" {$tables['builds']} builds ".
"WHERE executions.tcversion_id ={$tcversionSet} " .
"AND   execution_id=executions.id " .
"AND   executions.build_id=builds.id " .
"ORDER BY builds.name,bug_id";
$map = $db->get_recordset($sql);
// BUGID 3440 - added is_object() check
if( !is_null($map) && is_object($bug_interface))
{
foreach($map as $elem)
{
$bug_list[$elem['bug_id']]['link_to_bts'] = $bug_interface->buildViewBugLink($elem['bug_id'],GET_BUG_SUMMARY);
$bug_list[$elem['bug_id']]['build_name'] = $elem['build_name'];
}
}
return($bug_list);
}

评 论

论坛新帖



建议使用IE 6.0以上浏览器,800×600以上分辨率,法律顾问:上海信义律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2022, 沪ICP备05003035号
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪公网安备 31010102002173号

51Testing官方微信

51Testing官方微博

扫一扫 测试知识全知道