PHPUnit + Selenium 2.35 = BadMethodCallException -
my english not good. sorry.
i have:
phpunit 3.7.24 selenium 2.35.0
i starting selenium server:
java -jar /usr/local/bin/selenium-server-standalone-2.35.0.jar
output:
04.09.2013 13:51:15 org.openqa.grid.selenium.gridlauncher main info: launching 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, core v2.35.0. built 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
my simple test:
public function testtitle() { $this->url('/'); $this->assertequals('my title.', $this->title()); }
next, run phpunit test command:
phpunit --debug functional/mainpagetest.php
output:
phpunit 3.7.24 sebastian bergmann. configuration read /home/demyan112rv/www/boo/protected/tests/phpunit.xml starting test 'mainpagetest::testtitle'. e time: 17.59 seconds, memory: 2.75mb there 1 error: 1) mainpagetest::testtitle php warning: include(phpunit_extensions_story_testcase.php): failed 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' 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: command http://localhost:4444/wd/hub/session/url not recognized 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.
and in time in selenium server have next output:
13:55:39.438 info - executing: [new session: {browsername=firefox}] @ url: /session) 13:55:39.452 info - creating new session capabilities [{browsername=firefox}] 13:55:56.642 info - done: /session
i have error "badmethodcallexception: command http:/ /localhost:4444/wd/hub/session/url not recognized server.". bug fixed 2.35 in link , have 2.35 , have error.
how fix problem?
solution (i don't may answer on question, because rating less 10.
$ whereis phpunit phpunit: /usr/bin/phpunit /usr/bin/x11/phpunit /usr/local/bin/phpunit
i have 3 path phphunit. don't know, it's normal or no.
when changed command from:
phpunit --debug functional/mainpagetest.php
to
/usr/bin/phpunit --debug functional/mainpagetest.php
it's working!!!
if have setup browser launch method i.e
function setup() { $this->setbrowser("*firefox"); $this->setbrowserurl("http://www.google.com/"); }
your function should this
public function testtitle() { $this->open('/'); $this->assertequals('my title.', $this->title()); }
i've changed $this -> url('/'); $this -> open('/'); please try now.
Comments
Post a Comment