On a virtual machine (clean, fresh Ubuntu 11.04 server) I created a test website as described in Creating your first Yii application , and now I want to create a simple test using webdriver-test .
I set the correct TEST_BASE_URL to protected / tests / WebTestCase.php and created protected / tests / functional / MySimpleTest.php
<?php
Yii::import( 'ext.webdriver-bindings.CWebDriverTestCase' );
class MySimpleTest extends CWebDriverTestCase {
protected function setUp() {
parent::setUp( '192.168.57.1', 4444, 'firefox' );
}
public function testMySite() {
$this->get( TEST_BASE_URL );
$qElem = $this->findElementBy( LocatorStrategy::linkText, 'Users' );
$this->assertNotNull( $qElem, 'There is no "Users" link!' );
$qElem->clickAndWait();
$this->assertTrue( $this->isTextPresent( 'test1@example.com' ), 'The is no "test1@example.com" text on result page!' );
}
}
The launch is as follows:
etam@ubuntu:/var/www/test/protected/tests$ phpunit functional/MySimpleDbTest.php
PHPUnit 3.5.15 by Sebastian Bergmann.
E
Time: 5 seconds, Memory: 5.25Mb
There was 1 error:
1) MySimpleTest::testMySite
PHPUnit_Framework_Exception: setBrowserUrl() needs to be called before start().
/opt/yii-1.1.8.r3324/framework/test/CWebTestCase.php:61
/var/www/test/protected/extensions/webdriver-bindings/CWebDriverTestCase.php:156
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Note that it complains about setBrowserUrl () from PHPUnit_Extensions_SeleniumTestCase_Driver, which does not match the name from CWebDriverTestCase.
I tried to figure out what was going on, but it's too complicated for me. This is similar to the problems with the old and new selenium APIs that exist together, but I'm not sure about that.
I use:
- Ubuntu 11.04 Server
- yii 1.1.8.r3324
- webdriver-test 1.1b
- phpunit 3.5.15 (, bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544)
, !