我正在使用PHP进行自动化功能单元测试.我想使用PHPStorm在登台环境上运行测试,并且我关注以下链接:https://www.sitepoint.com/using-selenium-with-phpunit/.我有完整的任务,直到以下代码:
我已经访问了此链接,但不适用于我. The path to the driver executable must be set by the webdriver.gecko.driver system property
<?PHP
/**
* Created by PHPStorm.
* User: Developer4
* Date: 11/2/2016
* Time: 1:41 PM
*/
class uatTest extends PHPUnit_Extensions_Selenium2TestCase
{
public function setUp()
{
$this->setHost('localhost');
$this->setPort(4444);
$this->setbrowserUrl('https://www.facebook.com/');
$this->setbrowser('firefox');
}
public function tearDown()
{
$this->stop();
}
public function validInputsProvider()
{
$inputs[] = [
[
'email' => 'user',
'pass' => 'pass'
]
];
return $inputs;
}
public function testFormSubmissionWithUsername()
{
$this->byName('email')->value('user');
$this->byId('loginbutton')->submit();
$email = $this->byName('email');
$this->assertEquals('user', $email->value());
}
}
错误:
C:\wamp\bin\PHP\PHP5.6.25\PHP.exe C:/wamp/www/PHPUnit-and-Composer-Workflow/vendor/PHPunit/PHPunit/PHPunit --no-configuration uatTest C:\wamp\www\PHPUnit-and-Composer-Workflow\test\uatTest.PHP --teamcity
Testing started at 2:53 PM ...
PHPUnit 5.6.2 by Sebastian Bergmann and contributors.
The path to the driver executable must be set by the webdriver.gecko.driver system property; for more @R_617_4045@ion, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driver.PHP:165
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driver.PHP:72
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase\SessionStrategy\Isolated.PHP:67
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase.PHP:296
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase.PHP:337
C:\wamp\www\PHPUnit-and-Composer-Workflow\vendor\PHPunit\PHPunit-selenium\PHPUnit\Extensions\Selenium2TestCase.PHP:314
Time: 823 ms, Memory: 3.50MB
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Process finished with exit code 2
解决方法:
这是解决方案:
java -Dwebdriver.gecko.driver="C:\Users\Developer4\Downloads\geckodriver-v0.11.1-win32\geckodriver.exe" -jar C:\wamp\bin\PHP
\PHP5.6.25\selenium-server-standalone-3.0.1.jar
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。