【问题标题】:trouble with selenium RC installation (maybe I install it in a wrong way)?selenium RC 安装有问题(也许我以错误的方式安装它)?
【发布时间】:2012-06-09 19:38:05
【问题描述】:

我安装 PHPUnit 和 Selenium 以在 PHP 中进行测试。我已经成功使用 PHPUnit,但 Selenium 似乎有问题。

我正在关注“使用 Yii 1.1 和 PHP5 的敏捷 Web 应用程序开发人员”一书,在第 47 页第 3 章遇到问题。我将指南按照命令运行(我使用的是 Win 7)

cd cd protected/tests/
phpunit functional/SiteTest.php

这是控制台上的输出:

C:\wamp\www\demo\protected\tests>phpunit functional/SiteTest.php
PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to o
pen stream: No such file or directory in C:\wamp\www\yii\framework\test\CWebTest
Case.php on line 11
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Tex
tUI\Command.php:125
PHP   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin\php\php5.3.8\pear
\PHPUnit\TextUI\Command.php:134
PHP   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin\php\php5.3.8\pear
\PHPUnit\TextUI\Command.php:615
PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.3.8\pear\P
HPUnit\TextUI\Command.php:833
PHP   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\U
til\Fileloader.php:79
PHP   8. include_once() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Util\Fileloader.ph
p:95
PHP   9. require_once() C:\wamp\www\demo\protected\tests\bootstrap.php:8
PHP  10. YiiBase::autoload() C:\wamp\www\demo\protected\tests\bootstrap.php:0
PHP  11. include() C:\wamp\www\yii\framework\YiiBase.php:402

Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s
tream: No such file or directory in C:\wamp\www\yii\framework\test\CWebTestCase.
php on line 11


Call Stack:
    0.0004     326016   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0
    0.2333     731432   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3
.8\phpunit:46
    0.2334     731784   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.
8\pear\PHPUnit\TextUI\Command.php:125
    0.2334     731784   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin
\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:134
    0.3216    1235192   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin
\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:615
    0.3282    1247704   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\p
hp\php5.3.8\pear\PHPUnit\TextUI\Command.php:833
    0.3300    1247792   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.
3.8\pear\PHPUnit\Util\Fileloader.php:79
    0.3312    1252432   8. include_once('C:\wamp\www\demo\protected\tests\bootst
rap.php') C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Util\Fileloader.php:95
    0.5287    1527000   9. require_once('C:\wamp\www\demo\protected\tests\WebTes
tCase.php') C:\wamp\www\demo\protected\tests\bootstrap.php:8
    0.5289    1527648  10. YiiBase::autoload() C:\wamp\www\demo\protected\tests\
bootstrap.php:0
    0.5471    1550384  11. include('C:\wamp\www\yii\framework\test\CWebTestCase.
php') C:\wamp\www\yii\framework\YiiBase.php:402

我安装 Selenium RC 按照这篇文章http://geekswithblogs.net/Saqib/archive/2008/01/03/setting-up-selenium-rc-server-in-windows.aspx

1. Download latest Java SE from http://java.sun.com/ and install

2. Download latest version of Selenium RC from and extract

3. Create a folder named Selenium at C:\Program
Files\Java\jdk1.6.0_03\bin

4. Copy all files under Selenium-server-0.9.2 which you will find in
the extracted folder and paste in the newly created folder

5. From Command prompt run the following commands:

cd \ 
cd C:\PROGRA~1\Java\jdk1.6.0_03\bin
java -jar .\Selenium\selenium-server.jar -interactive

【问题讨论】:

  • 由于 PHPUnit/Extensions/... 是一个相对路径,这个路径在你的 include_path 中吗?看起来 PHP 只是没有找到文件?!
  • 检查 config/test.php 中的路径

标签: windows tdd yii selenium-rc


【解决方案1】:

这对我有用(Ubuntu),

pear 安装 phpunit/phpunit_selenium

然后重新启动服务器。 希望这对你也适用于 Win7。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-09-25
    • 2022-01-10
    • 2020-03-02
    • 2017-06-08
    • 2018-11-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多