Sunday, July 24, 2011

Mysql db sites/forums

Best sites to learn the mysql db are:

1.  On Linux - click here

2.  Convert Kb -> Mb -> Gb -> Tera byte.  - http://egret.net/kb__mb.htm


Thursday, July 21, 2011

Selenium IDE + Flex plugins ( FlexPilot & FlexMonkium)


FlexMonkium:

IDE extension to automate flex applications.

1. How to install & automate - click here 

2. Video clip - click here

3. Step & Step instruction guide  - click here

4. From saucelabs doc - click here

5. From blogspot - click here    click here

6. 

TestMaker (functional + load + webservice)



TestMaker (all in one tool)


Sl
No
Title
Description
1.
Introduction

2.
Setup & Install

3.
How to perform load testing

4.
TestMaker for Functional Testing

5.
TestMaker  for webservice Testing

6.
Integrate TestMaker with Selenium, JUnit

7.
Integrate TestMaker with SoapUI

8.
TestMaker – scripts in Java, Ruby, PHP, ,NET, Groovy, VB & Python & many more

Thursday, July 14, 2011

Selenium RC + PHPUnit

Install Steps:


Windows:
-------------

1. PHP Install:

    1.1 Precautions:  Before installing, first check is php available in your system. If so either delete or continue with existing one.
    1.2 Check system | enviroment variables, is path or variables are set, either delete or continue with same.
     1.3 NowiInstall PHP [ visit site - http://windows.php.net/downloads/releases/ download either msi or zip package.  Preferably in C:\php folder]

2. PEAR install:

     2.1  Precautions:  First check in your system, PEAR already exists.  If so continue or delete.
            If u r deleting means, need to delete all system environment variable those are set earlier.

     2.2  Open cmd prompt, goto php folder & install PEAR package.
             C:\php>go-pear.bat

    This will install the pear package, but some times for the packages latest PEAR version might be needed.  So visit the site, http://pear.php.net/package/PEAR/download to check the latest versions. & then type command as mentioned in the site.

        2.3  While installing, pear.bat will prompt to know the location for installing.
                 Carefully set the locations, by default choose C:\php

        2.4  To know, PEAR is install successfully, type in cmd prompt, C:\php> pear -config
               It displays all config settings & commands.

3. PHPUnit Install:

      3.1  Check PHPUnit package already exists in C:\php\PEAR folder.  If not, proceed as below.
   
      3.2  Before installing PHPUnit, need to initialize the channels(websites) from which dependency packages are to be downloaded.  To do this,

              C:\php> pear update-channels or pear channel-update      ; it will update all channels.
               OR
              discover each channel as below

                  pear channel-discover pear.phpunit.de
                  pear channel-discover pear.phpunit.com
                  pear channel-discover pear.symfony-project.com
                  pear channel-discover components.ez.no

       3.3  Now install PHPUnit.   C:\php> pear install phpunit/PHPUnit
               make sure u will get the message - install ok:  channel:<>/PHPUnit<version>
               If you did not get this message, instead any error message means, follow them carefully & try to succeed in installing the PHPUnit.
               After installing successfully, to check phpunit is installed correctly, then try to locate the file phpunit.bat in C:\php folder. If exists means, it is installed correctly.
               
4. Write & Execute PHP unit tests.

       4.1 Open any editor & write php test code.  Example:

             <?php
require_once 'PHPUnit/Framework.php';

class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>            

   4.2 Save file as Class name, StackTest.php in the c:\php folder.

   4.3  Run the test, C:\php> phpunit StackTest.php, will get result as below:

            PHPUnit 3.5.14 by Sebastian Bergmann.
Time: 1 second, Memory: 3.00Mb

OK (1 test, 5 assertions)


5. Explore more about PHPUnit testing, assertions -  http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html


6. Selenium RC setup:
   
     6.1 Download selenium RC jar file & locate anywhere.  Ex: C:\Selenium|Selenium-server.jar

     6.2 Open cmd prompt, then run jar file,  C:\Selenium> java -jar selenium-server.jar
            Now selenium server starts running at the backend.

7. Preparing test script using Selenium IDE

    7.1   Open Mozilla firefox browser > Tools > Selenium IDE ( if not installed, install IDE as addon)





    7.2   Record your script > export as PHPUnit script.  


7.3   Selenium script in PHPUnit framework



7.4  Save file in C:\php under either class name or any of your choice.


8. Running the scripts

    8.1 In one cmd prompt, selenium server will be running.
    8.2 Open one more cmd prompt to run the script like C:\php> phpunit Example

          See below how the script will be executed






 

             
     
         

 
     

Unit Testing Frameworks

1. Complete list of ALL Unit Testing Frameworks - click here

2.

PHPUnit

What is PHPUnit ?


It is a unit testing framework for PHP.  Means best useful for the projects or products designed in PHP.
It is opensource tool, can be installed either any machine os.


How to Install PHPUnit ?


1. Install PHPUnit on windows - click here to know

Install PHPUnit on Windows

Install Steps:


Windows:
-------------

1. PHP Install:

    1.1 Precautions:  Before installing, first check is php available in your system. If so either delete or continue with existing one.
    1.2 Check system | enviroment variables, is path or variables are set, either delete or continue with same.
     1.3 NowiInstall PHP [ visit site - http://windows.php.net/downloads/releases/ download either msi or zip package.  Preferably in C:\php folder]

2. PEAR install:

     2.1  Precautions:  First check in your system, PEAR already exists.  If so continue or delete.
            If u r deleting means, need to delete all system environment variable those are set earlier.

     2.2  Open cmd prompt, goto php folder & install PEAR package.
             C:\php>go-pear.bat

    This will install the pear package, but some times for the packages latest PEAR version might be needed.  So visit the site, http://pear.php.net/package/PEAR/download to check the latest versions. & then type command as mentioned in the site.

        2.3  While installing, pear.bat will prompt to know the location for installing.
                 Carefully set the locations, by default choose C:\php

        2.4  To know, PEAR is install successfully, type in cmd prompt, C:\php> pear -config
               It displays all config settings & commands.

3. PHPUnit Install:

      3.1  Check PHPUnit package already exists in C:\php\PEAR folder.  If not, proceed as below.
   
      3.2  Before installing PHPUnit, need to initialize the channels(websites) from which dependency packages are to be downloaded.  To do this,

              C:\php> pear update-channels or pear channel-update      ; it will update all channels.
               OR
              discover each channel as below

                  pear channel-discover pear.phpunit.de
                  pear channel-discover pear.phpunit.com
                  pear channel-discover pear.symfony-project.com
                  pear channel-discover components.ez.no

       3.3  Now install PHPUnit.   C:\php> pear install phpunit/PHPUnit
               make sure u will get the message - install ok:  channel:<>/PHPUnit<version>
               If you did not get this message, instead any error message means, follow them carefully & try to succeed in installing the PHPUnit.
               After installing successfully, to check phpunit is installed correctly, then try to locate the file phpunit.bat in C:\php folder. If exists means, it is installed correctly.
               

                Example of errors i faced & fixed are:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




C:\php>pear install phpunit/PHPUnit
Failed to download pear/HTTP_Request2 within preferred state "stable", latest re
lease is version 2.0.0RC1, stability "beta", use "channel://pear.php.net/HTTP_Re
quest2-2.0.0RC1" to install
phpunit/PHPUnit can optionally use PHP extension "curl"
phpunit/PHPUnit can optionally use PHP extension "dbus"
pear/XML_RPC2 requires package "pear/HTTP_Request2" (version >= 0.6.0)
phpunit/PHPUnit requires package "pear/XML_RPC2"
No valid packages found
install failed






C:\php>pear channel-discover pear.php.net
Channel "pear.php.net" is already initialized


C:\php>pear install HTTP_Request2-2.0.0RC1
Failed to download pear/Net_URL2 within preferred state "stable", latest release
 is version 0.3.1, stability "beta", use "channel://pear.php.net/Net_URL2-0.3.1"
 to install
pear/HTTP_Request2 requires package "pear/Net_URL2" (version >= 0.3.0)
pear/HTTP_Request2 can optionally use PHP extension "curl"
pear/HTTP_Request2 can optionally use PHP extension "fileinfo"
pear/HTTP_Request2 can optionally use PHP extension "openssl"
No valid packages found
install failed


C:\php>pear install NET_URL2
Failed to download pear/NET_URL2 within preferred state "stable", latest release
 is version 0.3.1, stability "beta", use "channel://pear.php.net/NET_URL2-0.3.1"
 to install
install failed






C:\php>pear install NET_URL2-0.3.1
downloading Net_URL2-0.3.1.tgz ...
Starting to download Net_URL2-0.3.1.tgz (8,488 bytes)
.....done: 8,488 bytes
install ok: channel://pear.php.net/Net_URL2-0.3.1


C:\php>pear install HTTP_Request2-2.0.0RC1
pear/HTTP_Request2 can optionally use PHP extension "curl"
pear/HTTP_Request2 can optionally use PHP extension "fileinfo"
pear/HTTP_Request2 can optionally use PHP extension "openssl"
downloading HTTP_Request2-2.0.0RC1.tgz ...
Starting to download HTTP_Request2-2.0.0RC1.tgz (95,353 bytes)
.....................done: 95,353 bytes
install ok: channel://pear.php.net/HTTP_Request2-2.0.0RC1


C:\php>pear install phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "curl"
phpunit/PHPUnit can optionally use PHP extension "dbus"
downloading PHPUnit-3.5.14.tgz ...
Starting to download PHPUnit-3.5.14.tgz (118,697 bytes)
..........................done: 118,697 bytes
downloading XML_RPC2-1.1.1.tgz ...
Starting to download XML_RPC2-1.1.1.tgz (68,431 bytes)
...done: 68,431 bytes
install ok: channel://pear.php.net/XML_RPC2-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit-3.5.14


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

4. Write & Execute PHP unit tests.

       4.1 Open any editor & write php test code.  Example:

             <?php
require_once 'PHPUnit/Framework.php';

class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>            

   4.2 Save file as Class name, StackTest.php in the c:\php folder.

   4.3  Run the test, C:\php> phpunit StackTest.php, will get result as below:

            PHPUnit 3.5.14 by Sebastian Bergmann.
Time: 1 second, Memory: 3.00Mb

OK (1 test, 5 assertions)




5. Explore more about testing, assertions -  http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html



             
     
           

   
       

Unit Testing Tools

Sl No.
                     Details

1
2

3

4

5

6

7

























Unit Testing



Sl No.
                     Details

1
About Unit Testing
2
Types of Unit Testing
3
Unit Testing frameworks
4
Unit Testing Tools
5
JUnit
6
TestNG
7
PHPUnit