phpunit selenium2重复测试不工作

phpunit selenium2重复测试不工作,selenium,selenium-webdriver,phpunit,laravel-5.2,selenium-chromedriver,Selenium,Selenium Webdriver,Phpunit,Laravel 5.2,Selenium Chromedriver,我正在尝试使用selenium2运行phpunit来测试我的php代码 php version : 5.6 laravel version : 5.2 phpunit vesrion : PHPUnit 3.7.28 by Sebastian Bergmann. 启动selenium服务器的初始命令: java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar ~/Downloads/selenium-server-standalone-

我正在尝试使用selenium2运行phpunit来测试我的php代码

php version : 5.6
laravel version : 5.2
phpunit vesrion : PHPUnit 3.7.28 by Sebastian Bergmann.
启动selenium服务器的初始命令:

java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar ~/Downloads/selenium-server-standalone-3.4.0.jar
Mytest.php

class Mytest extends PHPUnit_Extensions_Selenium2TestCase
{
public function setUp() {

    $this->setHost('localhost');
    $this->setPort(4444);
    $this->setBrowserUrl('http://www.example.com');
    $this->setBrowser('chrome'); // firefox

    //parent::setUp();
}

public function tearDown() {
    $this->stop();

    //parent::tearDown();
}


public  function testcheckhere(){
    $this->url("http://www.google.com");
    sleep(5);
}
}
当我使用以下命令通过命令行运行上述代码时:

vendor/bin/phpunit --filter testcheckhere --verbose --repeat 2 --log-junit textexe.xml tests/selenium/MyTest.php 
我发现以下错误:

    PHPUnit 5.7.9 by Sebastian Bergmann and contributors.

Runtime:       PHP 5.6.31-2+ubuntu14.04.1+deb.sury.org+1
Configuration: /var/www/html/CRM/phpunit.xml

.E                                                                  2 / 2 (100%)

Time: 9.04 seconds, Memory: 6.25MB

There was 1 error:

1) Mytest::testcheckhere
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'lp-0500', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-43-generic', java.version: '1.8.0_151'
Driver info: driver.version: unknown

/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:165
/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php:175
/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php:100
/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:394
/var/www/html/mycode/tests/selenium/MyTest.php:29
/var/www/html/mycode/tests/selenium/MyTest.php:29
/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:348
/var/www/html/mycode/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:314

ERRORS!
Tests: 2, Assertions: 0, Errors: 1.
此外,当测试运行时,chrome浏览器在第一次测试期间只打开一次,以后不再尝试再次打开它。

php版本:5.6 laravel版本:5.2 phpunit-vesrion:phpunit 3.7.28由塞巴斯蒂安·伯格曼创作

在Xampp文件夹中更新PHPUnit版本,如下所示:

1-在此处下载PHPUnit的最新版本: 2-复制“C:\xampp\php”中的“phpunit.phar”。 3-在文件“phpunit.bat.bat”中,将以下行:“%PHPBIN%”C:\xampp\php\phpunit”%*更新为:“%PHPBIN%”C:\xampp\php\phpunit.phar”%*

您有版本兼容性问题,一旦您的php版本和phpunit版本彼此兼容,那么您的应用程序将无问题运行。下载phpunit.phar文件版本5.7.26,因为它将与您的PHP版本兼容

同时删除您的功能:

公共函数拆卸(){ $this->stop()


}

selenium server似乎不知道在哪里可以找到webdriver。如果将chromedriver二进制文件和selenium server jar放在同一目录中,则不必指定Dwebdriver.chrome.driver参数。使用asterix尝试
$this->setBrowser('*chrome')
,并在设置方法
$this->setBrowserUrl
中设置测试基础url,然后在测试中只需调用
$this->url('/')
phpunit将自动调用以test开头的所有方法,因此不需要--filter参数。这些是我的建议,但我对这件事不熟悉。祝你好运。这与硒测试有什么关系?你正在使用的PHPUnit硒库。您必须设置所有版本的兼容性以解决错误
//parent::tearDown();