Phpunit+selenium Environment Construction
This environment set up encountered quite a lot of trouble, finally still can not solve their own, fortunately, a colleague " Frog " help solve the problem! Here put my pro-test steps to everyone listed, hope to provide you with convenience!
Install pear:
Go-pear.phar Download Address:http://download.csdn.net/detail/e421083458/4602207
Download Go-pear.phar file to C:\wamp\bin\php\php5.3.13\PEAR
Then execute the following command:
CD C:\wamp\bin\php\php5.3.13php-d phar.require_hash=0 Pear/go-pear.phar
Then just hit the carriage return and enter Y on Y. After installation it will prompt you to double-click.
C:\wamp\bin\php\php5.3.13\PEAR_ENV.reg to add an environment variable. It is necessary to add PHP to the environment variables for the following operations and for later use.
Upgrade Pear:
Install PHPUnit directly it will prompt the version is too low this is going to upgrade pear.
After the successful upgrade:
After the product upgrade
Installing phpunit
Pear clear-cachepear channel-discover pear.phpunit.depear channel-discover components.ez.nopear channel-discover Pear.symfony-project.compear install-a-F phpunit/phpunit
Installation succeeded:
Installing the phpunit extension
Pear channel-discover pear.symfony.compear Install phpunit/dbunitpear channel-discover pear.phpunit.depear Install Phpunit/phpunit_story
Success:
Installing the Selenium extension
Pear Install Phpunit/phpunit_selenium
Success:
Debug Selenium
Selenium-server-standalone-2.6.0.jar Download Address:http://download.csdn.net/detail/e421083458/4882037
Open Selenium-server
Java-jar C:\wamp\selenium-server-standalone-2.25.0.jar -interactive -log selenium.log
Success:
Installing the selenium IDE plugin for Firefox
Address:http://seleniumhq.org/download/
Click 1.9.0 for selenium IDE installation.
For specific recording methods see:
http://blog.163.com/lgh_2002/blog/static/44017526201259113351146/
Test script:
baiducase.php
Setbrowser ("*firefox"); $this->setbrowserurl ("http://www.baidu.com/"); } Public Function Testmytestcase () { $this->open ("/"); $this->type ("id=kw", "Hello"); $this->click ("Id=su"); $this->waitforpagetoload ("30000"); $this->assertequals (0,0); }? >
To start the test:
PHPUnit baiducase.php
Test success:
Reference Documentation:
Http://www.phpunit.de/manual/3.7/en/index.html
http://pear.phpunit.de/
http://seleniumhq.org/download/