Integrating PHPUnit with Selenium
Today I committed the initial work for integrating Selenium RC with PHPUnit.
Selenium RC "is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.".
In this case it is PHPUnit that drives the execution of the web application UI tests, using PEAR's new Selenium package to communicate with the Selenium RC Server.
Selenium RC "is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.".
In this case it is PHPUnit that drives the execution of the web application UI tests, using PEAR's new Selenium package to communicate with the Selenium RC Server.
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser('*firefox');
$this->setBrowserUrl('http://www.example.com/');
}
public function testTitle()
{
$this->open('http://www.example.com/');
$this->assertTitleEquals('Example Web Page');
}
}
?>
sb@wopr-mobile ~ % phpunit WebTest PHPUnit 3.0.0 by Sebastian Bergmann. . Time: 00:05 OK (1 test)
http://www.example.com/ and to return the title of the loaded page. This string is then passed back to PHPUnit to evaluate the assertion of the unit test.
09/10/2006 at 07:18 Permalink
But also as the founder of OpenQA, I have to ask: any chance you'd like to bring your work in to OpenQA/Selenium RC so it can sit along side the Java/.NET/perl/python/ruby add-ons?
Reply
25/07/2007 at 09:48 Permalink
Reply
25/07/2007 at 09:50 Permalink
Reply
22/12/2008 at 09:47 Permalink
i want to konw whether or not Integrating PHPUnit with Selenium can run under command line enviroment.
if the answer is yes ,how can i get it
thank you very much
Reply
22/12/2008 at 09:53 Permalink
Reply
25/12/2008 at 15:24 Permalink
I have tried as you direct in the document.
1. Copy PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php into your webserver's document root directory.
2. In your webserver's php.ini configuration file, configure PHPUnit/Extensions/SeleniumTestCase/prepend.php and PHPUnit/Extensions/SeleniumTestCase/append.php as the auto_prepend_file and auto_append_file, respectively.
3. In your test case class that extends PHPUnit_Extensions_SeleniumTestCase, use
protected $coverageScriptUrl = 'http://host/phpunit_coverage.php';
to configure the URL for the phpunit_coverage.php script.
but the coverage report i have has nothing in it.
is there anything i ignore?
Reply
25/12/2008 at 16:41 Permalink
Reply
14/12/2009 at 12:01 Permalink
Reply