如题

TestLink的主要功能

  1. 测试需求管理
  2. 测试用例管理
  3. 测试用例对测试需求的覆盖管理
  4. 测试计划的制定
  5. 测试用例的执行
  6. 大量测试数据的度量和统计功能。

但 Testlink 无缺陷管理

下载

github home

1
2
wget https://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/1.9.17.tar.gz
tar -xzvf 1.9.17.tar.gz

解压之后得到 testlink-code-1.9.17 将其移至 web 目录(/home/unginx/apps) 并改名为 testlink

nginx 站点配置

1
vim /usr/local/nginx/vhosts/testlink.conf

配置文件内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {
listen 80;
server_name testlink.apg.com;
charset utf-8;
access_log logs/testlink.apg.com.access.log;
error_log logs/testlink.apg.com.error.log;
root /home/unginx/apps/testlink/;
index index.php;

location ~ [^/].php(/|$) {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}

然后执行下面的命令使配置生效。

1
/usr/local/nginx/sbin/nginx -s reload

安装配置

访问 testlink.apg.com
点击【New installation】

检查配置,有失败项,不能继续。

以下有关 LDAP 的配置警告,可以先不管。

1
Checking LDAP library	Failed! LDAP library not enabled. LDAP authentication cannot be used. (default internal authentication will works).

作如下配置

1
2
3
[root@centOS7BasicForTest apps]# mkdir -p /var/testlink/logs/
[root@centOS7BasicForTest apps]# mkdir -p /var/testlink/upload_area/
[root@centOS7BasicForTest apps]# chown -R unginx:gweb /var/testlink

然后刷新


可以继续了,不过还可以修改 php 配置使最前面两项达到安装要求。
针对检查结果提示,修改 php 配置
1
vim /usr/local/php/etc/php.ini

修改以下项

1
2
3
4
#session.gc_maxlifetime = 1440
session.gc_maxlifetime = 2400
#max_execution_time = 30
max_execution_time = 120

重启

1
/etc/init.d/php-fpm restart

我们要用 mysql,所以,忽略 Postgres 和 MSSQL。
这样,除了 load,其它项均符合要求。
继续到下一步,填写数据库配置相关项,然后继续。


最后一步,出错了,大概是因为数据库访问地址没有权限访问。

Database Error Message: Invalid argument

提示信息:

1
2
3
4
5
TestLink setup will now attempt to setup the database:

Creating connection to Database Server:Failed!
Please check the database login details and try again.
Database Error Message: Invalid argument

以上错误,在 windows 本地搭建相同的 php 版本,web 服务器用的是 apache,用 phpStorm 调试,最终发现是 ip 地址和密码在调用 preg_replace 方法时被修改了,所以会出错。
需要修改源代码来解决。

nginx 提示的信息如下,不过,这个信息可忽略。

1
2018/07/12 11:24:04 [error] 7281#0: *335 FastCGI sent in stderr: "PHP message: PHP Deprecated:  __autoload() is deprecated, use spl_autoload_register() instead in /home/unginx/apps/testlink/third_party/phpmailer/PHPMailerAutoload.php on line 45" while reading response header from upstream, client: 192.168.1.89, server: testlink.apg.com, request: "POST /install/installNewDB.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "testlink.apg.com", referrer: "http://testlink.apg.com/install/installDbInput.php?"

## 解决
修改文件:testlink-code-1.9.17\install\installNewDB.php
大概从第 63 行开始,找到下面的变量,注释掉 preg_replace 所在的行。

1
2
3
4
5
6
7
8
$db_server = trim($_SESSION['databasehost']);
//$db_server = preg_replace($san,'',$db_server);

$db_admin_pass = trim($_SESSION['databaseloginpassword']);
//$db_admin_pass = preg_replace($san,'',$db_admin_pass);

$tl_db_passwd = trim($_SESSION['tl_loginpassword']);
//$tl_db_passwd = preg_replace($san,'',$tl_db_passwd);

不注释的话

  1. 会将 IP 地址里的点“吃掉”,如 192.168.1.3 会变成 19216813
  2. 会将密码里的特殊字符“吃掉”

修改之后再次运行,提示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
TestLink setup will now attempt to setup the database:

Creating connection to Database Server:OK!

Database testlink does not exist.
Will attempt to create:
Creating database `testlink`:OK!
Creating Testlink DB user `testlinkDbUser`:OK! ( ok - new user)
Processing:sql/mysql/testlink_create_tables.sql
OK!
Writing configuration file:OK!

IMPORTANT NOTICE - IMPORTANT NOTICE - IMPORTANT NOTICE - IMPORTANT NOTICE
YOU NEED TO RUN MANUALLY Following Script on your DB CLIENT Application
C:\workspace\php\testlink-code-1.9.17\install/sql/mysql/testlink_create_udf0.sql
THANKS A LOT

YOUR ATTENTION PLEASE:
To have a fully functional installation You need to configure mail server settings, following this steps
copy from config.inc.php, [SMTP] Section into custom_config.inc.php.
complete correct data regarding email addresses and mail server.


Installation was successful!
You can now log in to Testlink (using login name:admin / password:admin - Please Click Me!).

登录出错

http://tl.dev.com/login.php

1
mysqli_real_connect(): (HY000/1045): Access denied for user 'testlinkDbUser'@'192.168.1.89' (using password: YES) - in C:\workspace\php\testlink-code-1.9.17\third_party\adodb\drivers\adodb-mysqli.inc.php - Line 124,[source] => GUI,[timestamp] => 1531377269,[userID] => 0,[sessionID] => ,[transactionID] => ,[activityCode] => PHP,[objectID] => ,[objectType] => ,[transaction] => ,[*activateCaching] => ,[dbID] => ,[*detailLevel] => 4294967295,[*userFeedback] => ,[*serializationInterfaces] => ,[*serializationFormatDescriptors] => ,[*tables] => Array ([assignment_status] => assignment_status,[assignment_types] => assignment_types,[attachments] => attachments,[builds] => builds,[cfield_build_design_values] => cfield_build_design_values,[cfield_design_values] => cfield_design_values,[cfield_execution_values] => cfield_execution_values,[cfield_node_types] => cfield_node_types,[cfield_testplan_design_values] => cfield_testplan_design_values,[cfield_testprojects] => cfield_testprojects,[custom_fields] => custom_fields,[db_version] => db_version,[events] => events,[execution_bugs] => execution_bugs,[execution_tcsteps] => execution_tcsteps,[executions] => executions,[inventory] => inventory,[issuetrackers] => issuetrackers,[testproject_issuetracker] => testproject_issuetracker,[codetrackers] => codetrackers,[testproject_codetracker] => testproject_codetracker,[keywords] => keywords,[milestones] => milestones,[node_types] => node_types,[nodes_hierarchy] => nodes_hierarchy,[object_keywords] => object_keywords,[platforms] => platforms,[plugins] => plugins,[plugins_configuration] => plugins_configuration,[req_coverage] => req_coverage,[req_relations] => req_relations,[req_specs] => req_specs,[req_specs_revisions] => req_specs_revisions,[reqmgrsystems] => reqmgrsystems,[testproject_reqmgrsystem] => testproject_reqmgrsystem,[requirements] => requirements,[req_versions] => req_versions,[req_revisions] => req_revisions,[req_notify_assignments] => req_notify_assignments,[req_monitor] => req_monitor,[rights] => rights,[risk_assignments] => risk_assignments,[role_rights] => role_rights,[roles] => roles,[testcase_relations] => testcase_relations,[tcversions] => tcversions,[tcsteps] => tcsteps,[testcase_keywords] => testcase_keywords,[testplan_platforms] => testplan_platforms,[testcase_script_links] => testcase_script_links,[testplan_tcversions] => testplan_tcversions,[testplans] => testplans,[testprojects] => testprojects,[testsuites] => testsuites,[text_templates] => text_templates,[transactions] => transactions,[user_assignments] => user_assignments,[user_group] => user_group,[user_group_assign] => user_group_assign,[user_testplan_roles] => user_testplan_roles,[user_testproject_roles] => user_testproject_roles,[users] => users),[*views] => Array ([tcversions_last_active] =>  tcversions_last_active,[last_executions] => last_executions,[last_executions_by_platforms] => last_executions_by_platforms,[latest_tcase_version_number] => latest_tcase_version_number,[latest_req_version] => latest_req_version,[latest_rspec_revision] => latest_rspec_revision),[*auditCfg] => stdClass Object ([eventSource] => GUI,[logEnabled] => 1))) called at [C:\workspace\php\testlink-code-1.9.17\lib\functions\logger.class.php:558]

授权即可

1
GRANT ALL PRIVILEGES ON *.* TO 'testlinkDbUser'@'192.168.1.89' IDENTIFIED BY 'abd123K^4@#!' WITH GRANT OPTION;

testlink 配置为中文

$tlCfg->default_language = ‘en_GB’替换为
$tlCfg->default_language = ‘zh_CN’
然后以管理员身份登录之后,将语言设置为中文即可,如下所示:


时区显示不正确配置

解决方法是在根目录下的 config.inc.php 文件的 /* [GLOBAL] / 下加入以下代码

1
2
putenv("TZ=Asia/Shanghai");
date_default_timezone_set("PRC");

与 jira 集成

选【jira (Interface: db)】模式

1
2
3
4
5
6
7
8
9
10
<issuetracker>
<jiraversion>7.5.2</jiraversion>
<dbhost>192.168.1.91:3306</dbhost>
<dbname>jira</dbname>
<dbtype>mysql</dbtype>
<dbuser>root</dbuser>
<dbpassword>123456</dbpassword>
<uriview>http://jira.apg.com/browse/</uriview>
<uricreate>http://jira.apg.com/secure/Dashboard.jspa</uricreate>
</issuetracker>

testlink 和 jira 的集成,一般步骤

还有待研究,还没有找到添加 jira bug 的入口。

  1. System-Issue Tracker Management 添加 JIRA 的 db 模式,如上。
  2. 测试项目管理,“Issue Tracker Integration” 勾选 “活动的“,并选择 ”Issue Tracker“。
  3. 测试用例页面,点击新增的Bug管理图标,可进入 JIRA 系统。
  4. 到JIRA系统中提交问题,复制问题编号。
  5. 将问题编号与TestLink中的测试用例进行关联,关联后测试用例下方会显示相关联的Bug标题,点击标题可以直接链接到JIRA系统的此Bug页面。

报错

应该是有 Bug,暂时未解决,后来又重新添加计划任务,没有再出现这个错误,应该是前一步新建测试计划,保存的时候因为输入的内容有中文或者有特殊字符导致没有保存成功,后来没有重现。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#0  database->exec_query( /* Class:testplan - Method: get_builds_for_html_options */ SELECT id, name  FROM builds WHERE testplan_id =   AND active=1  AND is_open=1  ORDER BY name ASC, -1) called at [/home/unginx/apps/testlink/lib/functions/database.class.php:728]
#1 database->fetchColumnsIntoMap( /* Class:testplan - Method: get_builds_for_html_options */ SELECT id, name FROM builds WHERE testplan_id = AND active=1 AND is_open=1 ORDER BY name ASC, id, name) called at [/home/unginx/apps/testlink/lib/functions/testplan.class.php:1978]
#2 testplan->get_builds_for_html_options(, 1, 1) called at [/home/unginx/apps/testlink/lib/functions/tlTestCaseFilterControl.class.php:1239]
#3 tlTestCaseFilterControl->init_setting_build() called at [/home/unginx/apps/testlink/lib/functions/tlTestCaseFilterControl.class.php:571]
#4 tlTestCaseFilterControl->init_settings() called at [/home/unginx/apps/testlink/lib/functions/tlFilterControl.class.php:246]
#5 tlFilterControl->__construct(database Object ([db] => ADODB_mysqli Object ([databaseType] => mysqli,[dataProvider] => mysql,[hasInsertID] => 1,[hasAffectedRows] => 1,[metaTablesSQL] => SELECT
TABLE_NAME,
CASE WHEN TABLE_TYPE = 'VIEW' THEN 'V' ELSE 'T' END
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA=,[metaColumnsSQL] => SHOW COLUMNS FROM `%s`,[fmtTimeStamp] => 'Y-m-d H:i:s',[hasLimit] => 1,[hasMoveFirst] => 1,[hasGenID] => 1,[isoDates] => 1,[sysDate] => CURDATE(),[sysTimeStamp] => NOW(),[hasTransactions] => 1,[forceNewConnect] => 1,[poorAffectedRows] => 1,[clientFlags] => 0,[substr] => substring,[port] => 3306,[socket] => ,[_bindInputArray] => ,[nameQuote] => `,[optionFlags] => Array ([0] => Array ([0] => 5,[1] => 0)),[arrayClass] => ADORecordSet_array_mysqli,[multiQuery] => ,[_genIDSQL] => update %s set id=LAST_INSERT_ID(id+1);,[_genSeqSQL] => create table if not exists %s (id int not null),[_genSeqCountSQL] => select count(*) from %s,[_genSeq2SQL] => insert into %s values (%s),[_dropSeqSQL] => drop table if exists %s,[database] => testlink,[host] => 127.0.0.1,[user] => testlinkDbUser,[password] => not stored,[debug] => ,[maxblobsize] => 262144,[concat_operator] => +,[length] => length,[random] => rand(),[upperCase] => upper,[fmtDate] => 'Y-m-d',[true] => 1,[false] => 0,[replaceQuote] => \',[charSet] => ,[metaDatabasesSQL] => ,[uniqueOrderBy] => ,[emptyDate] => ,[emptyTimeStamp] => ,[lastInsID] => ,[hasTop] => ,[readOnly] => ,[genID] => 0,[raiseErrorFn] => ,[cacheSecs] => 3600,[memCache] => ,[memCacheHost] => ,[memCachePort] => 11211,[memCacheCompress] => ,[sysUTimeStamp] => ,[noNullStrings] => ,[numCacheHits] => 0,[numCacheMisses] => 0,[pageExecuteCountRows] => 1,[uniqueSort] => ,[leftOuter] => ,[rightOuter] => ,[ansiOuter] => ,[autoRollback] => ,[fnExecute] => ,[fnCacheExecute] => ,[blobEncodeType] => ,[rsPrefix] => ADORecordSet_,[autoCommit] => 1,[transOff] => 0,[transCnt] => 0,[fetchMode] => 2,[null2null] => null,[bulkBind] => ,[_oldRaiseFn] => ,[_transOK] => ,[_connectionID] => mysqli Object ([affected_rows] => ,[client_info] => ,[client_version] => ,[connect_errno] => ,[connect_error] => ,[errno] => ,[error] => ,[error_list] => ,[field_count] => ,[host_info] => ,[info] => ,[insert_id] => ,[server_info] => ,[server_version] => ,[stat] => ,[sqlstate] => ,[protocol_version] => ,[thread_id] => ,[warning_count] => ),[_errorMsg] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND active=1 AND is_open=1 ORDER BY name ASC' at line 1,[_errorCode] => ,[_queryID] => 1,[_isPersistentConnection] => ,[_evalAll] => ,[_affected] => ,[_logsql] => ,[_transmode] => ,[*connectionParameters] => Array (),[databaseName] => testlink),[queries_array] => Array (),[is_connected] => 1,[nQuery] => 0,[overallDuration] => 0,[dbType] => mysqli,[databaselogEnabled] => 0,[databaselogQueries] => 0)) called at [/home/unginx/apps/testlink/lib/functions/tlTestCaseFilterControl.class.php:340]
#6 tlTestCaseFilterControl->__construct(database Object ([db] => ADODB_mysqli Object ([databaseType] => mysqli,[dataProvider] => mysql,[hasInsertID] => 1,[hasAffectedRows] => 1,[metaTablesSQL] => SELECT
TABLE_NAME,
CASE WHEN TABLE_TYPE = 'VIEW' THEN 'V' ELSE 'T' END
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA=,[metaColumnsSQL] => SHOW COLUMNS FROM `%s`,[fmtTimeStamp] => 'Y-m-d H:i:s',[hasLimit] => 1,[hasMoveFirst] => 1,[hasGenID] => 1,[isoDates] => 1,[sysDate] => CURDATE(),[sysTimeStamp] => NOW(),[hasTransactions] => 1,[forceNewConnect] => 1,[poorAffectedRows] => 1,[clientFlags] => 0,[substr] => substring,[port] => 3306,[socket] => ,[_bindInputArray] => ,[nameQuote] => `,[optionFlags] => Array ([0] => Array ([0] => 5,[1] => 0)),[arrayClass] => ADORecordSet_array_mysqli,[multiQuery] => ,[_genIDSQL] => update %s set id=LAST_INSERT_ID(id+1);,[_genSeqSQL] => create table if not exists %s (id int not null),[_genSeqCountSQL] => select count(*) from %s,[_genSeq2SQL] => insert into %s values (%s),[_dropSeqSQL] => drop table if exists %s,[database] => testlink,[host] => 127.0.0.1,[user] => testlinkDbUser,[password] => not stored,[debug] => ,[maxblobsize] => 262144,[concat_operator] => +,[length] => length,[random] => rand(),[upperCase] => upper,[fmtDate] => 'Y-m-d',[true] => 1,[false] => 0,[replaceQuote] => \',[charSet] => ,[metaDatabasesSQL] => ,[uniqueOrderBy] => ,[emptyDate] => ,[emptyTimeStamp] => ,[lastInsID] => ,[hasTop] => ,[readOnly] => ,[genID] => 0,[raiseErrorFn] => ,[cacheSecs] => 3600,[memCache] => ,[memCacheHost] => ,[memCachePort] => 11211,[memCacheCompress] => ,[sysUTimeStamp] => ,[noNullStrings] => ,[numCacheHits] => 0,[numCacheMisses] => 0,[pageExecuteCountRows] => 1,[uniqueSort] => ,[leftOuter] => ,[rightOuter] => ,[ansiOuter] => ,[autoRollback] => ,[fnExecute] => ,[fnCacheExecute] => ,[blobEncodeType] => ,[rsPrefix] => ADORecordSet_,[autoCommit] => 1,[transOff] => 0,[transCnt] => 0,[fetchMode] => 2,[null2null] => null,[bulkBind] => ,[_oldRaiseFn] => ,[_transOK] => ,[_connectionID] => mysqli Object ([affected_rows] => ,[client_info] => ,[client_version] => ,[connect_errno] => ,[connect_error] => ,[errno] => ,[error] => ,[error_list] => ,[field_count] => ,[host_info] => ,[info] => ,[insert_id] => ,[server_info] => ,[server_version] => ,[stat] => ,[sqlstate] => ,[protocol_version] => ,[thread_id] => ,[warning_count] => ),[_errorMsg] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND active=1 AND is_open=1 ORDER BY name ASC' at line 1,[_errorCode] => ,[_queryID] => 1,[_isPersistentConnection] => ,[_evalAll] => ,[_affected] => ,[_logsql] => ,[_transmode] => ,[*connectionParameters] => Array (),[databaseName] => testlink),[queries_array] => Array (),[is_connected] => 1,[nQuery] => 0,[overallDuration] => 0,[dbType] => mysqli,[databaselogEnabled] => 0,[databaselogQueries] => 0), execution_mode) called at [/home/unginx/apps/testlink/lib/execute/execNavigator.php:29]

使用指南

中译版:TestLink教程:一份完整指南
英文原版:TestLink Tutorial: A Complete Guide
其它学习资料:TestLink学习四:TestLink1.9.13使用说明

load 加载失败,尝试配置,未成功

1
Checking LDAP library	Failed! LDAP library not enabled. LDAP authentication cannot be used. (default internal authentication will works).

尝试解决

1
yum -y install openldap php-gd gd-devel php-ldap

php.ini 修改

1
2
3
extension=ldap
```
重启 php,提示:Unable to load dynamic library 'ldap'

[root@centOS7BasicForTest testlink]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm [12-Jul-2018 11:10:50] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library ‘ldap’ (tried: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ldap (/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ldap: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ldap.so (/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ldap.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
done
`
编译参数添加 –with-ldap 后重新安装,也没管用。
故,先放弃。

相关链接

https://github.com/TestLinkOpenSourceTRMS/testlink-code
http://www.testlink.org/
http://www.mantis.org.cn/