We use compuware testpartner and Watir/Ruby for test automation, I created a common PHP page that can be called by either to update TL status.
It is a simple straight forward PHP file that accepts query string values to pass to the DB execution table.
(I am sure there is a better way to write this, but I am a PHP noob)
Copy the code below and save it as tlupdate.php off the the root testlink web dir.
You will need to know the Testplan ID of the TP you want to execute against.
The Test Case id of the test case the script validates.
If you navigate to this page without any option.. there are two sample links at the bottom that will build a sample Query String.
Assumptions --
-it will figure out the most current build number for the testplanid passed in.
-If no date/time is passed it will grab NOW from the hosting server.
-You will need to assign an tester ID: Just right click and select properties on the tester name in the admin section of testlink look for.. userid=
-In my scripts I have testplan set as a global variable or runtime parm.. set it once -- change when needed.
-you will need to know your DB connection information - replace it in the page below.
In our automated tests I wrote two routines.. one that builds a passed URL
and one that builds a failed URL with error text.
if a script passed I call the
TLPass(testcaseID,testplanID,notes)
which builds
ie.goto('http://qatestcase.frp.com/tlupdate.php?tc=[tcid]&tp=[testplan]&status=[p]¬es=[passed: Automation]'
TLFail(exception,testcaseID,testplanID)
-which builds
ie.goto('http://qatestcase.frp.com/tlupdate.php?tc=[tcid]&tp=[testplan]&status=[f]¬es=[exception message]'
TLFail is included in my standard error handling routine so when handle_error is called it is executed.
<?php
echo "<B>Required Values Passed</B> <br>";
echo "Status :".$_GET['status']."<br>";
echo "Test Case :".$_GET['tc']."<br>";
echo "Test Plan :".$_GET['testplan']."<br>";
echo "Time Stamp :".$_GET['tstamp']."<br>";
echo "Notes :".$_GET['notes']."<br>";
# Set Data Parms
$debug = 0;
$tester = '7';
$testplanid = $_GET['testplan'];
$status = $_GET['status'];
$tstamp = $_GET['tstamp'];
$notes = $_GET['notes'];
$time = time();
$exectime = date('Y-m-d h:m:s');
$dbname = 'testlink170';
#Build Query
$tcidquery = "SELECT tcversion_id FROM testplan_tcversions where testplan_id = ".$testplanid." and tcversion_id in (select id from nodes_hierarchy where parent_id = ".$_GET['tc']." order by id desc)";
#$tcidquery = "select id from nodes_hierarchy where parent_id = ".$_GET['tc']." order by id desc";
$buildidquery = "select id from Builds where testplan_id = ".$testplanid." order by id desc";
echo "<hr><p><b>Connect to DB</b><br>";
$link = mysql_connect('localhost', 'yourusername', 'yourpass');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db($dbname);
echo "<hr><p><b>Get the Current TCversionID for Test Case</b><br>";
$tcresult = mysql_query($tcidquery);
$get = mysql_fetch_row($tcresult);
$tcid = $get[0];
print "<br> Returned Test Case Version ID: <B>".$tcid."</B><br>";
echo "<hr><p><b>Get most current Build ID for Testplan</b><br>";
$result = mysql_query($buildidquery);
$get1 = mysql_fetch_row($result);
$buildid = $get1[0];
print "<br> Using Buid ID".$buildid." for Testplan:".$testplanid;
#loop to display other choices
print "<p> Other Choices available (older builds):";
while ($row = mysql_fetch_assoc($result)) {
$out = $row['id'];
print "<br>TestPlan: ".$testplanid." Available Older Build: ".$out;
}
echo "<hr><p><B>Parm to pass to update</B>";
if ($tstamp == ''){
print '<p><B><I>NO DATE PASSED USING SERVER TIME</I></B>';
$tstamp = $exectime;
}
?>
<p>
<ul>
<li>TestPlan: <B><?php echo $testplanid; ?></B>
<li>Build: <B><?php echo $buildid; ?></B>
<li>TCversion: <B><?php echo $tcid; ?></B>
<li>Status: <B><?php echo $status; ?></B>
<li>TestUser: <B><?php echo $tester; ?></B>
<li>Date: <B><?php echo $tstamp; ?></B>
<li>ServerTime: <B><?php echo $exectime; ?></B>
<li>Notes: <B><?php echo $notes; ?></B>
</ul>
<hr><p><B>TESTLINK:</B>
<p>
<a href = "https://dev-4/testlink17/testlink.php?testplan=1095&tc=604&status=p&tstamp=2007-12-06 12:15:30¬es=This is a sample with passing"> Test Link: (Pass with date)<a> Will build a sample url string with all required parms
<p><a href = "https://dev-4/testlink17/testlink.php?testplan=1095&tc=604&status=f¬es=This is a sample FAIL: TestCase 2559 - Validation of Save Text Failed: Line 323"> Test Link:( Fail without date-user server date) <a> Will build a sample url string failing with no date passed in. Exp: user server date for timestamp.
<hr><p><B>Update Query:</B>
<p>
<?php
$updatequery = "INSERT INTO executions(build_id,tester_id,status,testplan_id,tcversion_id,execution_ts,notes) VALUES('".$buildid."','".$tester."','".$status."','".$testplanid."','".$tcid."','".$tstamp."','".$notes."')";
echo $updatequery;
if ($debug == 0){
mysql_db_query($dbname, $updatequery) or die("<BR><B>Failed Update Query of </B>" . $updatequery);
echo "<P><B>Update Complete!</B>";
}else echo "<P><B>DEBUG ON - NO UPDATE RUN!</B>";
mysql_close($link);
?>shaw557
TestLink user
Posts: 6
Joined: Thu Aug 02, 2007 1:44 pm
YIMTop
--------------------------------------------------------------------------------
by havlatm » Fri Dec 21, 2007 12:28 am
I would like to announce, that the next version (1. will have xml/rpc interface to add results from automated tools more easily.
You can download the latest CVS code to try it.
Anyway, thank you for the contribution.
分享到:
相关推荐
TestLink_XLSX_TO_XML 是一个实用工具,主要用于将Excel(XLSX)格式的测试用例数据转换成XML格式,以便于导入TestLink测试管理工具。TestLink是一款流行且功能强大的开源测试管理系统,用于组织、管理和执行软件测试...
# source /data/apache2/htdocs/Testlink/install/sql/alter_tables/1.9/mysql/DB.1.3/step1/db_schema_update.sql; # source /data/apache2/htdocs/Testlink/install/sql/alter_tables/1.9/mysql/DB.1.3/stepZ/z_...
"TestLink与Redmine集成" TestLink是一款开源的测试管理工具,而Redmine是一款项目管理工具。通过将TestLink与Redmine集成,可以实现测试用例与缺陷跟踪系统的结合,提高测试效率和项目管理的自动化程度。本文将...
sudo chmod 777 /var/testlink/logs /var/testlink/upload_area ``` 第一条命令将目录及其子目录的权限设为 755,允许用户执行、读取和写入,同时其他用户可以读取和执行。第二条命令将特定目录的权限设为 777,...
标题“TestLink_XLSX_TO_XML.7z”暗示了一个工具或程序,它与TestLink集成有关,并且能够将Excel(XLSX)文件转换为XML格式。TestLink是一款流行的开源测试管理工具,用于测试项目管理和缺陷跟踪。XML文件则通常用于...
7. **API接口**: TestLink 1.6.0可能已经包含了API接口,允许用户通过编程方式与TestLink交互,自动化某些测试管理任务,如同步测试结果、更新测试用例等。 8. **第三方集成**: 它可以与常见的缺陷跟踪系统(如...
6. 设置日志路径和上传文件夹:`$tlCfg->log_path='/data/apache2/htdocs/TestLink/logs/'`,`$g_repositoryPath=' /data/apache2/htdocs/TestLink/upload_area/'` 7. 保存配置文件 最后,访问TestLink的安装向导:...
根据提供的文档信息,我们可以深入探讨TestLink 1.9.2使用手册中提及的关键知识点,以便更好地理解该工具的功能及应用方法。 ### 一、通用信息 #### 1.1 整体结构 TestLink 1.9.2 的整体结构设计得非常直观,旨在...
在尝试安装TestLink 1.9.4时,可能会遇到一些错误提示,如"Checking if /var/testlink/logs/ directory exists failed"和"Checking if /var/testlink/upload_area/ directory exists failed"。这些错误表明系统无法...
这通常位于`/var/www/html/testlink/config_default.php`,根据你的环境修改数据库连接信息和其他设置。 接下来,运行初始化脚本来创建数据库结构: ```bash cd /var/www/html/testlink/admin php setup/setup.php...
vim ./testlink/config.inc.php $tlCfg->default_language = ``` - 根据实际情况设置Testlink的默认语言和其他配置选项。 通过以上步骤, 用户可以在Linux环境下成功安装和配置Testlink与mantis, 并能够利用这些...
$Config['UserFilesPath'] = '/testlink/upload_area/'; ``` 这个路径是指相对路径,表示图片将会被保存在 Testlink 安装目录下的 `upload_area` 文件夹内。 同时,还需要设置一个绝对路径,以告诉服务器图片的具体...
TestLink 数据库备份迁移 TestLink 是一个开源的测试管理系统,使用 MySQL 作为其后台数据库。为了确保数据的安全和可靠性,需要对数据库进行备份和迁移。本文将详细介绍 TestLink 数据库备份迁移的步骤和方法。 ...
打开IE浏览器,访问http://localhost/testlink/index.php,进入安装页面。 6. 安装Testlink 录入数据库信息,包括数据库名、登录用户名和密码等信息。点击继续,进入协议页面,然后勾选同意条款,点击Proceed,...
xampplite_mantis_testlink
TestLink是一款功能强大的开源测试管理工具,主要用于自动化测试和手动测试的组织与执行。这个"testlink_1.8.5"压缩包是TestLink的一个特定版本,它被标识为一个经过修改后的稳定版本,意味着它可能包含了社区或...
### Testlink 安装与配置详解 #### 一、Testlink 概述 Testlink 是一个开源的质量保证软件,主要用于管理测试用例和测试计划。它可以帮助团队更好地组织和跟踪测试活动,确保软件产品的质量。本文档将详细介绍 ...