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: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:
[Plain]View Plaincopyprint?
- CD C:\wamp\bin\php\php5.3.13
- php-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.
[Plain]View Plaincopyprint?
- Pear Clear-cache
- Pear Upgrade Pear
After the successful upgrade:
[Plain]View Plaincopyprint?
- Pear Upgrade-all
After the product upgrade
Installing PHPUnit
[Plain]View Plaincopyprint?
- Pear Clear-cache
- Pear Channel-discover pear.phpunit.de
- Pear Channel-discover components.ez.no
- Pear Channel-discover pear.symfony-project.com
- Pear install-a-F phpunit/phpunit
Installation succeeded:
Installing the PHPUnit Extension
[Plain]View Plaincopyprint?
- Pear Channel-discover pear.symfony.com
- Pear Install Phpunit/dbunit
- Pear Channel-discover pear.phpunit.de
- Pear Install Phpunit/phpunit_story
The omission of such a step would result in the following error:
Invalid response while accessing the Selenium Server at ' http://localhost:4444/selenium-server/driver/': Failed to start n EW browser Session:error while launching browser
Or
Exception:unable to bind to locking port 7054 within 45000
Success:
Installing the Selenium extension
[Plain]View Plaincopyprint?
- Pear Install Phpunit/phpunit_selenium
Success:
Debug Selenium
selenium-server-standalone-2.6.0.jar:http://download.csdn.net/detail/e421083458/4882037
Open Selenium-server
[Plain]View Plaincopyprint?
- 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
[PHP]View Plaincopyprint?
- <?php
- Class Example extends Phpunit_extensions_seleniumtestcase
- {
- protected function setUp ()
- {
- $this->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/
Phpunit+selenium Environment Construction