Mantis和Testlink分别是一款很好的开源的、用于中小型团队进行bug管理和
测试用例管理的工具。
他们支持多种环境下的安装。
这里,我对前段时间对它们的安装和集成做一个小结,希望能对您有所帮助。
基础环境:Apache_2.0.59(win32-x86-no_ssl.msi)
php-4.4.7(Win32)
mysql-4[1].1.16(win32)
Mantis和Testlink:
mantis-1.0.6
testlink_1.6.3
以上这些根据版本均可在网上搜索到安装文件,这里不罗列地址了。
一、基础环境的搭建顺序:Apache->php->Mysql
几个要点:1.文件尽量安装或解压到磁盘的根目录下。
2.路径名中不要包含空格。
PHP的安装:1.解压后(专指本文提到的版本)
将位于dlls和sapi文件夹中的文件移动到主文件夹中(例如C:\PHP)。
2.将PHP目录添加到PATH环境变量中。
3.将php.ini-recommended拷贝到c:\php目录下,重命名为php.ini。
4.注册动态链接库。
1)打开开始菜单中的命令提示行窗口,输入cmd;
2)输入类似cd C:\php的命令进入PHP目录;
3)输入regsvr32
php4activescrīpt.dll注册该DLL。
4)测试Activescrīpt是否正确工作:创建一个新文件test.wsf,在文件中输入
<job
id="test">
<scrīpt
language="ActivePHP">
$Wscrīpt->Echo("Hello
World!");
</scrīpt>
</job>
保存并双击这个文件。如果您看到一个小窗口,内容为“Hello World!",说明安装成功。
5)将PHP集成到Apache2.0。以Apache模块方式安装,将以下两行加入到Apache的httpd.conf配置文件中,用来设定Apache 2.0的PHP模块:
#对PHP 4用这两行:
LoadModule php4_module
"c:/php/php4apache2.dll"
AddType
application/x-httpd-php .php
#配置php.ini的路径
PHPIniDir
"C:/php"
用自己PHP实际所在的路径替换掉上例中的c:/php/。
在LoadModule指令中用的是php4apache2.dll,而不是php4apache.dll。
在Windows下给Apache的配置文件中加入路径值的时候,所有的反斜线例如c:\directory\file.ext必须转换成正斜线,如c:/directory/file.ext。
6)验证PHP是否正确安装。
创建并保存
test.php到
Web服务器的htdocs目录下,内容为:
<!-- begin of
test.php-->
<?php phpinfo();
?>
<!--end of
scrīpt-->
打开浏览器,输入
http://yoursite/test.php,例如:http://192.166.11.29:8080/test.php,界面上将显示PHP的版本信息。
7)设置Session存储路径。修改php.ini文件,设置session.save_path =C:\windows\temp。默认路径是UNIX上的写法,在Windows上不能正常工作。
Mysql的安装:
1)安装时,遇到复选框□skip sign-up,记得勾选。2)遇到有standard的选项,勾选。
3)遇到□Include Bin,勾选。
4)密码设置为root。
5)为了使用方便,可以考虑再安装一个图形化管理工具,这里我推荐使用mysql-gui-tools-5.0
-r11a-win32.msi。
6)如果服务器上启用了防火墙,那么需要在防火墙设置中添加一个例外端口,如端口号为3306。
二、安装Testlink和Mantis
Testlink和Mantis均可以选择手动安装和自动安装中任意一种,鉴于我们的数据库的版本的client问题以及我n多次自动安装头破血流的经验,我非常强烈的建议您选择手动安装。
首先将testlink和mantis安装文件拷贝到Web服务器的htdocs目录下,分别更名为testlink和mantis。
1.为Testlink和Mantis创建表和用户:
1)打开命令行窗口,输入:mysql –uroot –proot(注:假设安装MySQL时将root帐户的密码修改为root),进入MySQL。
2)创建数据库:
mysql> create database testlink;
mysql> create database mantis;
3)修改roottl帐号的密码。这个步骤主要是因为4.1版本后的MySQL使用了基于不同的密码算法的认证协议。如果服务器更新了版本,但是客户端API没有相应更新,就会出现认证失败的情况。这个情况可以通过执行以下sql语句来解决。
mysql> update mysql.user
set password = OLD_PASSWORD('root') where host = 'localhost' and user =
'root';
mysql> flush
privileges;
4)为Testlink和Mantis创建用户并赋予权限:
mysql> use testlink;
Testlink用户名/密码:testlink:
mysql> grant
select,insert,update,alter,index,create,delete,drop on testlink.* to testlink@"%"
identified by "testlink";
mysql> grant
select,insert,update,delete,index,drop,create,alter on testlink.* to testlink@"localhost" identified by "testlink";
mysql> use mantis;Mantis用户名/密码:
mantis:
mysql> grant
select,insert,update,alter,index,create,delete,drop on testlink.* to mantis@"%"
identified by "mantis";
mysql> grant
select,insert,update,delete,index,drop,create,alter on testlink.* to mantis@"localhost" identified by "mantis";
与3)同样的原因,更新testlink和
mantis:
mysql> update mysql.user
set password = OLD_PASSWORD('testlink') where host = 'localhost' and user =
'testlink';
mysql> update mysql.user
set password = OLD_PASSWORD('mantis') where host = 'localhost' and user =
'mantis';
mysql> flush
privileges;
特别说明:mantis1.0.6版本采用自动安装,安装时会有一些关于数据库访问方面的提示,不必理会;登陆mantis时,如果系统给出一些提示禁止administrator登陆,请执行上面有关mantis的sql语句后再重新登陆,记得执行flush privileges。2.安装testlink。
1)为testlink创建表,添加默认数据。
打开开始->运行,输入cmd,进入mysql的bin目录下
执行数据库初始化语句。依次将<Apache Install Dir>\
Apache2\htdocs\testlink\install\sql\文件夹下的testlink_create_tables.sql和testlink_create_default_data.sql的内容在MySQL内执行。
为了执行方便起见,建议将这2个.sql文件拷贝到磁盘根目录下,例如d:\。
执行:
mysql -uroot -p123456 test <d:\testlink_create_tables.sql;
mysql -uroot -p123456 test <d:\testlink_create_default_data.sql;2)
在<testlinkdir>/创建TestLink数据库配置文件config_db.inc.php,内容如下:
<?php // Automatically
Generated by TestLink Installer
define('DB_TYPE',
'mysql');
define('DB_USER',
'tl_16');
define('DB_PASS',
'tl_16');
define('DB_HOST',
'localhost'); //强烈建议用IP地址代替localhost
define('DB_NAME',
'tl_16');
?>
3.修改<testlink installation
directory>/config.inc.php
a.数据库的编码
define('DB_SUPPORTS_UTF8', TRUE)修改为define('DB_SUPPORTS_UTF8', FALSE)
b.TestLink中文显示
define('TL_TPL_CHARSET', DB_SUPPORTS_UTF8 ? 'UTF-8' : 'ISO-8859-1');
//define('TL_TPL_CHARSET', 'gb2312'); // Chinese charset
修改为:
//define('TL_TPL_CHARSET', DB_SUPPORTS_UTF8 ? 'UTF-8' : 'ISO-8859-1');
define('TL_TPL_CHARSET', 'gb2312'); // Chinese charset
4.登陆testlink。
1)打开浏览器,输入:http://yourwebsite:80/testlink/index.php,可以打开TestLink登陆界面。
默认的管理员登陆名和密码均为admin。2)安装成功后,移走安装目录下的install目录;修改admin的初始密码。
5.安装mantis。
1)在浏览器中输入:http://localhost/mantis/admin/install.php,可以登陆mantis安装目录。
2)admin用户名/密码:root
mantis的用户名/密码:mantis
3)打开mysql客户端,更新mantis数据库中表mantis_user_table中administrator的密码,如下:
update mantis_user_table
set password=123
where username='administrator';
6.登陆mantis。
1)在浏览器中输入:http://localhost/mantis/login.php
用户名/密码:administrator/123
如果无法登陆,请查看config_inc.php.sample文件是否已更名为config_inc.php,并对其中有关数据库信息进行更新。
2)进入account/prefernce,在最下面语言中选择simplified chinese,使mantis支持汉语。
三、集成Testlink&Mantis
1.修改<testlink installation
directory>/config.inc.php
define('TL_INTERFACE_BUGS', 'NO') 修改为 define('TL_INTERFACE_BUGS', 'MANTIS')
2.修改 <testlink installation directory>/cfg/ 下的 mantis.cfg.php 文件
define('BUG_TRACK_DB_HOST', 'localhost');
define('BUG_TRACK_DB_NAME',
'bugtracker'); mantis 安装时配置的数据库名
define('BUG_TRACK_DB_USER', 'root');
define('BUG_TRACK_DB_PASS', 'root');
define('BUG_TRACK_HREF',
"http://localhost/mantis/");
define('BUG_TRACK_ENTER_BUG_HREF',"http://localhost/mantis/"); 所指向的mantis的链接
现在同时打开mantis和testlink,来感受一下成功的喜悦!