Creating Selenium tests for your extension¶
- In order to create a Selenium test, you need to create a directory
Tests/Selenium/
in your extension directory and add some PHP files ending with*Test.php
containing a class extendingTx_Phpunit_Selenium_TestCase`with functions that :code`@test
annotation. - A test for testing if the text ‘Hello World!’ is present at a page with the ID=1 would look like this:
/**
* @test
*/
public function helloWorldIsPresent() {
$this->open('http://localhost/index.php?id=1');
$this->assertTextPresent('HelloWorld!');
}
- Consult the PHPUnit documentation for information on writing tests, available functions etc. See Chapter 17 for details on using PHPUnit for Selenium tests.