私の英語はあまり良くありません。ごめん。
私は持っている:
PHPUnit 3.7.24
Selenium 2.35.0
セレンサーバーを起動しています:
java -jar /usr/local/bin/selenium-server-standalone-2.35.0.jar
出力:
04.09.2013 13:51:15 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
13:51:25.373 INFO - Java: Sun Microsystems Inc. 20.45-b01
13:51:25.374 INFO - OS: Linux 3.8.0-29-generic i386
13:51:25.388 INFO - v2.35.0, with Core v2.35.0. Built from revision c916b9d
13:51:25.542 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:51:25.543 INFO - Version Jetty/5.1.x
13:51:25.544 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:51:25.545 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:51:25.546 INFO - Started HttpContext[/,/]
13:51:25.567 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@dda25b
13:51:25.567 INFO - Started HttpContext[/wd,/wd]
13:51:25.571 INFO - Started SocketListener on 0.0.0.0:4444
13:51:25.577 INFO - Started org.openqa.jetty.jetty.Server@b61fd1
私の簡単なテスト:
public function testTitle()
{
$this->url('/');
$this->assertEquals('My title.', $this->title());
}
次に、次のコマンドで phpunit テストを実行します。
phpunit --debug functional/MainPageTest.php
出力:
PHPUnit 3.7.24 by Sebastian Bergmann.
Configuration read from /home/demyan112rv/www/boo/protected/tests/phpunit.xml
Starting test 'MainPageTest::testTitle'.
E
Time: 17.59 seconds, Memory: 2.75Mb
There was 1 error:
1) MainPageTest::testTitle
PHP Warning: include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory in /home/demyan112rv/www/yii/YiiBase.php on line 421
PHP Warning: include(): Failed opening 'PHPUnit_Extensions_Story_TestCase.php' for inclusion (include_path='.:/home/demyan112rv/www/boo/protected/helpers:/home/demyan112rv/www/boo/protected/widgets:/home/demyan112rv/www/boo/protected/extensions/mail:/home/demyan112rv/www/boo/protected/services:/home/demyan112rv/www/boo/protected/components:/home/demyan112rv/www/boo/protected/models:/usr/share/php:/usr/share/pear') in /home/demyan112rv/www/yii/YiiBase.php on line 421
BadMethodCallException: The command http://localhost:4444/wd/hub/session/url is not recognized by the server.
/home/demyan112rv/www/yii/test/CWeb2TestCase.php:60
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
そして、今回はセレンサーバーで次の出力があります:
13:55:39.438 INFO - Executing: [new session: {browserName=firefox}] at URL: /session)
13:55:39.452 INFO - Creating a new session for Capabilities [{browserName=firefox}]
13:55:56.642 INFO - Done: /session
「BadMethodCallException: コマンド http:///localhost:4444/wd/hub/session/url がサーバーによって認識されません。」というエラーが表示されます。このバグはこのリンクで 2.35 で修正されましたが、私は 2.35 を使用しており、このエラーが発生しています。
この問題を解決するにはどうすればよいですか?
解決策(評価が 10 未満であるため、質問に答えない場合があります。
$ whereis phpunit
phpunit: /usr/bin/phpunit /usr/bin/X11/phpunit /usr/local/bin/phpunit
私はphphunitへの3つのパスを持っています。わかりません、それは正常か否かです。
コマンドを次から変更したとき:
phpunit --debug functional/MainPageTest.php
に
/usr/bin/phpunit --debug functional/MainPageTest.php
それは働いています!!!