在安装了phpunit和selenium的情况下测试以下对象:
<?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{
public function setUp()
{
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowser('firefox');
$this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
}
public function testHasLoginForm()
{
$this->url('');
$email = $this->byName('email');
$password = $this->byName('password');
$this->assertEquals('', $email->value());
$this->assertEquals('', $password->value());
}
}
这会抛出以下错误:
Time: 9 ms, Memory: 6.75Mb
There was 1 skipped test:
1) testLogin::testHasLoginForm
The Selenium Server is not active on host localhost at port 4444.
OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.
有办法解决这个问题吗?我在youtube上看了一个教程https://www.youtube.com/watch?v=zva_GETXimI#t=12,我几乎一开始就卡住了。
检查selenium服务器是否在您的主机上运行。