0

私は自分のPHPコードをテストするためにphpunitをselenium2で実行しようとしています。phpunit selenium2 repeat test not working

php version : 5.6 
laravel version : 5.2 
phpunit vesrion : PHPUnit 3.7.28 by Sebastian Bergmann. 

セレンサーバーを起動する初期コマンド:

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. 

また、テストが実行されている間は、最初のテストでクロムブラウザが1回だけ開き、後で再び開こうとしません。

+0

セレン、サーバーがどこwebdriverをを見つけるために知っていないようです。 –

+0

chromeriverバイナリファイルとseleniumサーバーjarを同じディレクトリに配置する場合、_Dwebdriver.chrome.driver_パラメータを指定する必要はありません。 asterixを使って '$ this-> setBrowser( '* chrome')'を試し、_setUp_メソッド '$ this-> setBrowserUrl'でテストベースURLを設定してください。テストで' $ this-> url( '/' ); 'phpunitは** test **で始まるすべてのメソッドをautomaticallyで呼び出すので、--filter引数は不要です。これらは私の提案ですが、私はこの問題では新しいです。がんばろう。 –

答えて

-2

phpバージョン:5.6 laravelバージョン:5.2 phpunit vesrion:PHPUnit 3.7.28 by Sebastian Bergmann。

のようにXAMPPフォルダ内の自分のPHPUnitのバージョンを更新します。ここにはPHPUnitの最後のバージョンをダウンロードし

の1-:https://phpunit.de/index.html 2 - コピー「phpunit.phar」「C:\ XAMPPの\ phpの」で。 "%PHPBIN%" "C:¥xampp¥php¥phpunit"%*: "%PHPBIN%" "C:\ xampp \ php \ phpunit.phar "%*

あなたのバージョンとphpunitのバージョンが互いに互換性があると、アプリケーションは問題なく動作します。それはあなたのPHPバージョン

また、あなたの機能を削除すると互換性がありますので、phpunit.pharファイルバージョン5.7.26をダウンロードしてください:

パブリック関数ティアダウン(){ ます$ this->停止() ;

//parent::tearDown(); 

}

+0

これはセレン試験とどのように関連していますか? –

+0

あなたが使用しているPHPUnit-Seleniumライブラリ。エラーを解決するには、すべてのバージョンの互換性を設定する必要があります – Sufyan