当我运行一个示例测试时,无论是在 Netbeans IDE 中还是从命令行运行,例如:
class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser('firefox');
$this->setBrowserUrl('http://www.example.com/');
}
public function testTitle()
{
$this->url('http://www.example.com/');
$this->assertEquals('Example WWW Page', $this->title());
}
}
我收到了 PHPUnit 响应,但它似乎没有与 Selenium 服务器通信,因为没有创建浏览器窗口。
PHPUnit 3.6.10 by Sebastian Bergmann.
Configuration read from /var/www/gcd/framework/yii/gadget/protected/tests/phpunit.xml
F
Time: 1 second, Memory: 10.50Mb
There was 1 failure:
1) WebTest::testTitle
Failed asserting that null matches expected 'Example WWW Page'.
使用 PHPUnit 3.6.10 和 selenium-server-standalone-2.21.0
有人有什么想法吗?
最佳答案
事实证明,如果您使用 sudo 运行 PHPUnit,它就可以工作!哦!
关于PHPUnit Selenium2 - 无浏览器实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10622277/