Selenium RC - PHP Client server

上一篇 / 下一篇  2008-05-17 16:20:27 / 个人分类:Selenium

近期在学习Selenium,Selenium的工具有四种,四种工具各有不同,各种工具的比较参见:http://blog.csdn.net/yangxiaogang/archive/2006/12/25/1460452.aspx . 我选择了Selenium RC,我所采用的语言是PHP.
PHPUnit集成了Selenium的API接口,通过直接调用Selenium的API即可完成测试动作和结果验证
本章主要介绍如何通过PHPUni驱动PHP client server完成测试.
1.下载selenium Rc:http://blog.csdn.net/yangxiaogang/archive/2006/12/25/1460452.aspx
2.解压到一个目录下,我的解压到了d:\seleniumrc
3.下载apache,我本机使用的是apache2.2.x
4.下载PHP5.x windows安装版本,我本机安装的是php-5.2.6-win32-installer.msi
5.安装PHP(我的安装路径D:\PHP),安装过程中注意选择安装"Extras"中的"PEAR Installer"
6.安装PEAR:PHP安装完成后,并未自动安装PEAR,所以我们要到PHP安装目录中,运行go-pear.bat进行安装,详细安装的过程参见:http://www.phpchina.com/bbs/viewthread.php?tid=61542.我在这只把重要的几步写下来.
(1)在go-pear命令窗口中,根据提示设定安装路径
(2)PEAR安装成后,根据提示修改PHP安装目录中的"PHP.INI"文件和配置环境变量,以下是我本地机上安装成功后的提示:
Would you like to alter php.ini <C:\WINDOWS\system32\php.ini>? [Y/n] : y

php.ini <C:\WINDOWS\system32\php.ini> include_path updated.

Current include path           : .;C:\php5\pear
Configured directory           : D:\PHP\www\pear
Currently used php.ini (guess) : C:\WINDOWS\system32\php.ini
Press Enter to continue:

** WARNING! Old version found at D:\PHP\www\bin, please remove it or be sure to use the new d:\php\www

The 'pear' command is now at your service at d:\php\www\bin\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use'd:\php\www\bin\pear.bat'until you have added
** 'D:\PHP\www\bin' to your PATH environment variable.
(3)根据上述红色字体的提示,先打开PHP安装目录中的"PHP.INI"文件,找到如下段落
; Windows: "\path1;\path2"
; include_path = ".;c:\php\includes"
   将其修改为
; Windows: "\path1;\path2"
include_path = ".;c:\php5\pear"

(4)执行pear.bat使pear命令设置到PATH路径中.
(5)右击我的电脑-高级-环境变量,将"D:\PHP\www\bin"加入"PATH"变量中.
7.PEAR安装完成后,继续安装PHPunit
(1) 首先加载PHPunit的chnnel,执行下列命令pear channel-discover pear.phpunit.de
(2) 继续安装:pear install phpunit/phpunit
(3) 直到出现提示" install ok: channel://pear.phpunit.de/PHPUnit-3.2.19",说明PHPUnit安装成功了.你可以在PEAR目录中找到它.
8.执行测试,以selenium rc/selenium-php-client-server中的GoogleTest.php为例
(1)保证selenium server一直运行.
CMD-到selenium-server路径下输入-java -jar selenium-server.jar
(2)启动测试用用例:
CMD-到selenium-php-client-server路径下输入-phpunit Goole.Test.php
(3)查看运行结果:
执行完成后,可以看到执行结果,如下:

FAILURES!
Tests: 1, Errors: 1.



TAG: Selenium

引用 删除 antonTT   /   2008-07-29 10:01:28
看了你的说明, 其中一些步骤我不太明白,比如:
(4)执行pear.bat使pear命令设置到PATH路径中
我运行完pear.bat, 它就自动消失了, 是不是说明已经设置到PATH路径中了?

(5)右击我的电脑-高级-环境变量,将"D:\PHP\www\bin"加入"ATH"变量中

我已经有一个selenium-server.jar的PATH变量, 我是不是可以把这个设成PATH1?


(1) 首先加载PHPunit的chnnel,执行下列命令pear channel-discover pear.phpunit.de
能否具体解释一下如何加载PHPUnit的Channel, 如何找到pear.phpunit.de这个文件?

非常感谢!
 

评分:0

我来说两句

Open Toolbar