How to run Selenium IDE scripts in Selenium RC using PHPUnit?
I am able to make selenium scripts in the selenium IDE and also able to export it in PHPUnit. I also installed PHPUnit(Which i guess is installed correctly) and the selenium-rc server(Which ran perfectly). Then i ran those scripts using the command: 'PHPUnit Testname.php' which gave nothing as an output. If anyone knows anything regarding running these PHPUnit scripts, please throw in some light. Tha开发者_开发技巧nks.............
The command to run the tests (without playing with filters etc...) includes the test suite name from which it deduces the filename. So,
phpunit Testname
rather than
phpunit Testname.php
Make sure your selenium RC is running. e.g. (java -jar selenium-server.jar)
Try saving this test as :
exampleTest.php
Then run it through the command line as :
phpunit exampleTest.php
Hope this helps.
<?php
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class exampleTest extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser('*firefox');
$this->setBrowserUrl('http://www.google.com');
}
public function testexampleTest()
{
echo "Navigating browser to stackoverflow.com ...";
$this->open('http://www.stackoverflow.com/');
$this->waitForPageToLoad('30000');
echo "Made it to stackoverflow!";
$this->sleep(5);
echo "Test Complete";
}
}
?>
精彩评论