PHPUnit Selenium2 - 没有浏览器实例

时间:2012-05-16 16:00:23

标签: phpunit selenium-webdriver

当我在命令行的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

任何想法?

1 个答案:

答案 0 :(得分:2)

事实证明,如果你用sudo运行PHPUnit,它就可以了!卫生署!