Monday, March 29, 2010

Selenium RC installation with phpunit

1].Install the java on the system from following URL:
http://www.java.com/en/download/manual.jsp#win

2].Download the selenium RC zip file (selenium RC 1.0.3)

3].Extract this zip in C:/selenium/

4].Download WampServer2.0i and Run the setup

5].Now open the command prompt:
Run C:\wamp\bin\php\php5.3.0>go-pear.bat

This will give following error
phar "C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar" does not have a signaturePHP W
arning: require_once(phar://go-pear.phar/index.php): failed to open stream: pha
r error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\
wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236

Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: pha
r error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\
wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
Press any key to continue . . .


For this issue:

A) Locate the "php.ini" file in C:\wamp\bin\php\php5.3.0\php.ini
Open php.ini in notepad.

B) Find the following line, in bold:

; http://php.net/phar.require-hash;phar.require_hash = On
; http://php.net/phar.require-hash

;phar.require_hash = On

C) Uncomment the ";phar.require_hash = On" line by removing the semi-colon.

D) Change "On" to "Off".

; http://php.net/phar.require-hash

phar.require_hash = Off

E) Save the file.


6].Now run the go-pear.bat
It will ask
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :

Type local
Then it will say
Please confirm local copy by typing 'yes' : yes

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix) : C:\wamp\bin\php\php5.3.0
2. Temporary directory for processing : C:\wamp\bin\php\php5.3.0\tmp
3. Temporary directory for downloads : C:\wamp\bin\php\php5.3.0\tmp
4. Binaries directory : C:\wamp\bin\php\php5.3.0
5. PHP code directory ($php_dir) : C:\wamp\bin\php\php5.3.0\pear
6. Documentation directory : C:\wamp\bin\php\php5.3.0\docs
7. Data directory : C:\wamp\bin\php\php5.3.0\data
8. User-modifiable configuration files directory: C:\wamp\bin\php\php5.3.0\cfg
9. Public Web Files directory : C:\wamp\bin\php\php5.3.0\www
10. Tests directory : C:\wamp\bin\php\php5.3.0\tests
11. Name of configuration file : C:\wamp\bin\php\php5.3.0\pear.ini
12. Path to CLI php.exe : .

1-12, 'all' or Enter to continue:
Just hit Enter

Then it will ask the follwoing question

Would you like to alter php.ini ? [Y/n] :
Type Y

7].After it
Run
pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit


It will show following errors
Unknown remote channel: pear.symfony-project.com
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channe
/pear.symfony-project.com/YAML, use --alldeps to download automatically
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version 1.8.0
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >=.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "channel://pear.symfony-project.co
AML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed

For this issue
Run
pear channel-discover pear.symfony-project.com


8].Then run
pear install phpunit/PHPUnit
it will again give
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, symfony/
AML, use --alldeps to download automatically
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version i1.8.0
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1..1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "symfony/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed

For this issue
Run
pear upgrade PEAR

9].Then run
pear install phpunit/PHPUnit

10].Then run
pear install Testing_Selenium-beta



11].To start the server in interactive mode
go to C:\selenium\selenium-remote-control-1.0.1\selenium-server-1.0.1 and type the following in the command prompt:

java -jar selenium-server.jar -interactive

12].Now put your php files converted from selenium IDE in C:\wamp\bin\php\php5.2.6

13].Now go to command prompt and go to path
C:\wamp\bin\php\php5.2.6
and run the command
phpunit filename.php