Wednesday, September 4, 2013

Installing Perl on Windows

Unlike Macintosh, Windows doesn't come with PERL by default so I am writing the steps involved to install PERL on windows.

Steps:

  1. Before installing PERL on windows make sure its not already installed on your machine, for that open command prompt (cmd) and type perl -v. If you get output like 'perl' is not recognized as an internal or external command, operable program or batch file that means perl is not installed on your system and you need to follow the steps mentioned below.
  2. There are 2 flavors of PERL available, one is Active PERL and second is Strawberry PERL. I personally recommend Active PERL for windows b'coz of ppm-installer as it allows you to add alternative ppm repositories which will give you access to almost all useful perl modules available on CPAN.
  3. To install Active Perl you need to download the executable file from here. Download the executable file which is compatible with your version of windows (32 bit or 64 bit). 
  4. Once you have downloaded the executable file, run the installer, accept the license click on next, then select the 2 checkboxes shown in the screenshot below

  5. Click on next and in next window click on Install, it will go thorough the installation process and in last window click on finish.
  6. To validate perl is successfully installed on your machine open your command prompt again and type perl -v, this time you will get the information about PERL as shown in the screenshot below.

If you are getting this information that means you are done with your PERL installation on Windows! 

Monday, September 2, 2013

Installing PHPUnit on Windows

I wanted to work on Selenium using PHP so I needed to install PHPUnit as PHPUnit supports Selenium for Automation Testing.

It wasn't an easy task, it took me a while to install PHPUnit on my system so I've written down the steps to finally get it working.


Steps:

  1. First you need to install PHP on your machine which is a mandate. Please download PHP for windows from here.

  2. Once you have downloaded the installer, run it and install and PHP anywhere you like and remember this path for later, choose your webserver and select any additional components as needed. Select none if you don't have any webserver.

  3. Once PHP is installed open a command prompt (cmd) and type php -v to check whether it is installed successfully or not. It should give you output like
              
                PHP 5.4.3 (cli) (built: Feb 2 2012 20:27:51)
                Copyright (c) 1997-2012 The PHP Group
                Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    
    
    if this isn't the output, please check your installation again.

  4. Before Installing PHPUnit, you need to install PEAR, which is a dependency for PHPUnit:
    • You need to download the go-pear.phar which can be downloaded from here.
    • Save go-pear.phar in the directory where you have installed PHP in step 2.
    • Open the command prompt in administrator mode. Navigate to the folder where you have PHP installed or you have saved the file in previous step.
    • To install PEAR type php go-pear.php in the command prompt and press ENTER.
    • Installation is pretty self explanatory you just need to provide the inputs once its asked.
    • In last step, it will ask to modfiy php.ini file, type Y and press ENTER.
    • After you are done on command prompt go to the folder where PHP is installed, you will find a file PEAR_ENV.reg, double click on that file to add it to the registry, this help you to run pear command from any folder.
    • Verify PEAR is working properly by running the pear version command on CMD(command prompt).

  5. Installing PHPUnit:
  • Go to command prompt and turn on the auto_discover in PEAR, use the command pear config-set auto_discover 1
  • Download and Install PHPUnit by running the command mentioned below pear install pear.phpunit.de/PHPUnit
  • Now to run PHPUnit from any folder, you need to set it to your windows PATH variable. Right Click on My Computer => Properties => Advanced System Settings => Environment Variables => Select path under system variables, Click Edit, navigate to its end, type semicolon (;) and then append the full path of your PHP folder after the semicolon.
  • Verify PHPUnit is working by running the following command phpunit --version

By following the commands mentioned above you would be able to successfully install PHPUnit on windows operating system.
Source:
http://www.viper007bond.com/2012/08/21/installing-phpunit-on-windows/