win7 x64配置TestLink执行用例提交BUG配置[连接mantisbt]

来源:互联网 发布:激光切割机软件 编辑:程序博客网 时间:2024/05/15 12:00
1. Testlink提交BUGmantisbt方式简化
1.1. Testlink提交BUG链接修改
1.1.1. 执行用例时,提交BUG的窗口链接修改为链接到mantis提交问题的页面
修改testlink\gui\templates\execute\inc_exec_show_tc_exec.tpl
如下:
 {if $tc_old_exec.build_is_open}
     <a href="javascript.:open_bug_add_window({$gui->tproject_id},{$tc_old_exec.id},{$tc_old_exec.execution_id},'link')">
换成=
  {if $tc_old_exec.build_is_open}
         {* 2016-09-12 xup 增加BUG时,进行testlink关联 *}
    {* <a href="javascript.:open_bug_add_window({$gui->tproject_id},{$tc_old_exec.id},{$tc_old_exec.execution_id},'link')"> *}
        <a href="http://localhost:80/mantisbt/bug_report_page.php?exec_id={$tc_old_exec.execution_id}" target='_blank'>
           {* ***********localhost需要换成公众都能访问的IP地址*************************************************}

1.1.2. mantis 提交bug的时候判断是否有exec_id参数传入
修改mantis\bug_report_page.php
<input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />后增加一行:
<input type="hidden" name="exec_id" value="<?php echo $_GET["exec_id"]; ?>" />
如下:
<tr>
<td class="form-title" colspan="2">
<input type="hidden" name="m_id" value="<?php echo $f_master_bug_id ?>" />
<input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
<?php echo lang_get( 'enter_report_details_title' ) ?>
</td>
</tr>
换成=
<tr>
<td class="form-title" colspan="2">
<input type="hidden" name="m_id" value="<?php echo $f_master_bug_id ?>" />
<input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
<!--2016-09-12 xup  增加BUG时,进行testlink关联-->
<input type="hidden" name="exec_id" value="<?php echo $_GET["exec_id"]; ?>" />
<!--***********************************************************--><?php echo lang_get( 'enter_report_details_title' ) ?>
</td>
</tr>
1.1.3. 在mantis目录下面新增bug_add_testlink.php页面,进行testlinkmantisBUG关联的处理
新增:mantis\bug_add_testlink.php
<?php
//2016-09-12 xup 增加BUG时,进行testlink关联
function write_execution_bug($exec_id, $bug_id,$just_delete=false)
{
$conn = mysql_connect("localhost","root","");
$execution_bugs = 'testlink.ttexecution_bugs';
// Instead of Check if record exists before inserting, do delete + insert
$sql = "DELETE FROM {$execution_bugs} " .
"WHERE execution_id={$exec_id} " .
"AND bug_id='" . $bug_id ."'";
$result = mysql_query($sql,$conn);
if(!$just_delete)
{
$sql = "INSERT INTO {$execution_bugs} " .
"(execution_id,bug_id) " .
"VALUES({$exec_id},'" . $bug_id . "')";
$result = mysql_query($sql,$conn);
}
return $result ? 1 : 0;
}
?>

1.1.4. 修改bug_report.php,如果存在exec_id,则进行testlinkmantisBUG关联
修改mantis\bug_report.php
1在一开始增加一句
//2016-09-12 xup 增加BUG时,进行testlink关联
require_once( 'bug_add_testlink.php' );
//***********************************************************//
2)修改如下内容:
$t_bug_id = $t_bug_data->create();
换成=
//2016-09-12 xup 增加BUG时,进行testlink关联
//$t_bug_id = $t_bug_data->create();
$testlink_exec_id = $_POST["exec_id"];
if ($testlink_exec_id!= "")
{
$t_bug_id = $t_bug_data->create();
write_execution_bug($testlink_exec_id,$t_bug_id);
}
else
{
$t_bug_id = $t_bug_data->create();
}
//***********************************************************//
3)修改如下内容:
<form method="post" action="<?php echo string_get_bug_report_url() ?>">
换成=
<!--2012-09-12 xup 增加BUG时,进行testlink关联-->
<!--<form method="post" action="<?php echo string_get_bug_report_url() ?>">-->
<form method="post" action="<?php echo string_get_bug_report_url() ?>?exec_id=<?php echo $_POST['exec_id']; ?>">
<!--***********************************************************-->

1.2. Mantis删除BUG时,自动删除testlink关联
1.2.1. 修改bug_add_testlink.php 增加删除bug时,自动删除testlink关联的函数
修改mantis\bug_add_testlink.php
//2016-09-12 xup 删除BUG时,删除对应的testlink关联  Mysql
function delete_testlink_bug($bug_id)
{
$conn = mysql_connect("localhost","root","root");
$execution_bugs = 'testlink.ttexecution_bugs';
$sql = "DELETE FROM $execution_bugs WHERE bug_id = $bug_id ";
$result = mysql_query($sql,$conn);
return $result ? 1 : 0;
}

1.2.2. 修改bug_actiongroup.php,调用删除testlink关联的函数
修改mantis\bug_actiongroup.php
在开始增加:
//2019-09-12 xup 删除BUG时,删除对应的testlink关联
require_once( 'bug_add_testlink.php' );
//***********************************************************//
修改如下内容:
bug_delete( $t_bug_id );
换成=
bug_delete( $t_bug_id );
//2016-09-12  xup 删除BUG时,删除对应的testlink关联
delete_testlink_bug($t_bug_id);






原创粉丝点击