lundi 24 avril 2017

Selenium with phpunit error "Undefined index: browserUrl"

I am getting started with selenium and phpunit testing, so i followed this tutorial https://www.youtube.com/watch?v=zva_GETXimI and installed selenium and phpunit. Not if i run empty test like below

require_once 'vendor/autoload.php';

class TestLogin extends \PHPUnit_Extensions_Selenium2TestCase{
}

it returns Time: 104 ms, Memory: 14.00MB No tests executed! that means its all set.

But when i right my first test case like below

require_once 'vendor/autoload.php';

class TestLogin extends \PHPUnit_Extensions_Selenium2TestCase{ public function setUpPage(){ $this->setHost('localhost'); $this->setPost('4444'); $this->serBrowser('firefox'); $this->setBrowserUrl('http://localhost/raw/selenium_testing/'); }

public function testHasLoginForm(){
    $this->url("index.php");
    $username = $this->byName("username")->value();
    $username = $this->byName("password")->value();

    $this->assertEquals('', $username);
    $this->assertEquals('', $password);
}

}

I get error

Time: 209 ms, Memory: 14.00MB
There was 1 error:
1) TestLogin::testHasLoginForm
Undefined index: browserUrl

I googled a lot but cant any documentation on this.

Aucun commentaire:

Enregistrer un commentaire