The required tools : {
* PHPUnit : {
> How to install : {
# Reference : {
http://nishutayaltech.blogspot.in/2011/04/installing-phpunit-on-windows.html,
http://www.mark-leong.com/installing-php-and-phpunit-on-windows-7/,
http://pear.phpunit.de/
},
[0] Install PEAR : {
Method 1: Run go-pear.bat in your php dir
Method 2: If no go-pear.bat in your php dir, then => {
# Reference: http://stackoverflow.com/questions/8276682/wamp-2-2-install-pear
[1] Download this file(http://pear.php.net/go-pear.phar) to your php dir. For example C:\Appserv\PHP5.4.6
[2] Open Windows's cmd.exe with the admin priviledge
[3] Change to your php dir, like cd C:\Appserv\PHP5.4.6
[4] Enter the command: php -d phar.require_hash=0 go-pear.phar
[5] Select whether you like or not a local copy or a system one. By typing system:local and pressing enter you'll install a local copy. By typing system and pressing enter you'll install a system-wide copy.
[6] Type yes to confirm the option chosen
[7] The next list of directories, will be the referring directories that PEAR will install its components. If you select from 1 - 12 you can change the directory you'd like to install. By typing all and pressing Enter you'll be able to change them all in a queued manner. In my case, I just pressed Enter and left all defaults
[8] If all fine, you shall see: WARNING! The include+path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working.
[9] If all fine, you shall be asked with "Would you like to alter php.ini ? [Y/n]". Type "y" to proceed.
[10] Execute the PEAR_ENV.reg to add some ENV variable into your windows enviroment
[11] Change to C:\ then type "pear" in the command line, you will see PEAR runs and lists a list commands for use.
}
},
[1] Register the PHPUnit channel with PEAR. Type the commands in the cmd.exe : {
> pear channel-discover pear.phpunit.de
> pear channel-discover components.ez.no
> pear channel-discover pear.symfony-project.com
> pear update-channels
},
[2] Install PHPUnit, typing > pear install phpunit/PHPUnit
}
},
* Selenium IDE
* Selenium 2.x server : {
> How to install & run : {
[0] Extract the downloaded .jar file to the place you like
[1] Run with command line: java -jar /path/to/yout_selenium_server.jar
}
},
* PHP Formatters for Selenium IDE : {
> https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
> https://github.com/brokenthumbs/PHP-Formatter
}
* PHPUnit_Selenium package in PEAR: {
> Please make sure PEAR and Selenium Server installed and run
> To install, run the command > pear install phpunit/PHPUnit_Selenium
}
}
Run a auto Selenium test on PHPUnit : {
* Reference: http://www.jaceju.net/blog/archives/1293/
[0] Go to Options > Options > General and enable the checkbox of "Enable experimental features" so as to enable the function of PHP Formatters for Selenium IDE
[1] Levarge the Selenium IDE to create one test case
[2] Click Options > Format > PHP(PHPUnit) to generate the PHPUnit test code based on the created test case. (You will be prompted with a warning message, just click OK to continue)
[3] In the Selenium IDE, click the Source tab next to the Table tab. You will see the PHP test codes generated.
[4] Save these generate PHP test codes in the proper PHP file.
[5] Open the cmd.exe and make sure the Selenium server in on
[6] Type the command > phpunit /path/to/the_saved_php_test_code_file to execute the Selenium test on PHPUnit
}
Tips : {
* Shutdown the Selenium server : {
> Selenium server operates a web server under Jetty it can receive commands via http through browsers. The following URL will be used to shut down the server => http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
> If we want to leave the server running and just close down the current session we could issue the following URL in a browser => http://localhost:4444/selenium-server/driver/?cmd=shutDown
}
}
- Mar 18 Tue 2014 23:17
[Test] Auto Selenium on PHPUnit
close
全站熱搜
留言列表
發表留言