Executing and Creating Selenium RC automation test cases using PHPUnit (by Sebastian Bergmann)

  1. Setup PHPUnit framework http://www.unclecode.com/2010/05/install-phpunit-on-wamp-xamp-manually-without-pear/ assuming PHP 5.2.x is already installed in your system. If not download wamp to install PHP or browse php.net download section to install PHP.
  2. Make sure your PHP path is set in your environment so that you can execute PHP through command prompt. For reference check step 3 and 4 of article http://www.unclecode.com/2010/05/install-phpunit-on-wamp-xamp-manually-without-pear/Download and install latest Java JRE (if does not exist on your system).
  3. Download Selenium server and start the server through following command on command prompt http://seleniumhq.org/download/
  4. The above steps are explained in http://www.unclecode.com/2012/05/how-to-setup-selenium-webdriver-and-execute-automation-script/
  5. Download and Install latest firefox
  6. Install Firefox Selenium IDE plugin http://seleniumhq.org/download/ under section Selenium IDE “Download version 1.8.0 released on 24/April/2012”
  7. Install Selenium PHP plugin to generate/export scripts of type PHPUnit framework https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
  8. Record script through Selenium IDE plugin
  9. Save the test suit and Export test case to PHPUnit framework through Selenium IDE export option under File menu
  10. Open command line and make sure phpunit is working by executing command “phpunit –version”
  11. Open the file which you have exported above in a editor and include the following line-
  12. require_once(‘PHPUnit/Extensions/SeleniumTestCase.php’);
  13. The name of the file (like PhpUnitSelenium.php) and class name should be same i.e. like-
    class PhpUnitSelenium extends PHPUnit_Extensions_SeleniumTestCase
  14. Make sure your selenium running in a command prompt
  15. Now open another command prompt and browse to the directory where you have saved the exported test case file and execute the following command like-
    C:\wamp\www\php-selenium-webdriver\tests>phpunit PhpUnitSelenium
  16. The above should open a new selenium firefox window to execute tests
Bookmark and Share
Both comments and pings are currently closed.

Comments are closed.

n