How to install PHP, Apache, MySQL on Ubuntu in two commands

Installing LAMP stack on Ubuntu 10.04 and above involves having access to terminal window and root user.

First install tasksel which is used to execute tasks on system like installation of LAMP.

1. To install tasksel, execute the following command-

sudo apt-get install tasksel

2. Now install PHP, Apache, MySQL

sudo tasksel install lamp-server

Done. Now open a browser window and type “http://locahost”. You will see a message “It Work’s”.

Automation testing using integration of Selenium, PHPUnit, Ant and create reports

Prerequisites for the integration of automation suit Selenium, PHPUnit and Ant are as below-

Install Ant

Download ant from “zip” file for windows.
Follow all the steps for installation and  also optionally install the libraries as mentioned

Automation testing using integration of Selenium, PHPUnit and Ant

Run Selenium through command prompt as mentioned in one of the article above.

Create a folder “runtests”  under your project directory some where on the file system.

This “runtests” folder will contain all the selenium test case files generated through Selenium IDE.

Create AllMyTests.php file under runtests folder. This configures phpunit to execute all the files under runtest folder.  Source code provided below.

Create build.xml file under your project directory adjacent to rntests folder.

On Command Prompt run/execute the following command in this folder (make sure ant is configured, test ant -version on command prompt to check)-
>ant build

This will read build.xml file and execute all the selenium test cases. Source code for build.xml is provided below.


<!– This project launches the test generator and execute all phpunit selenium tests –>
<project name=”proj” default=”build” basedir=””>
<!–Get environment variables –>
<property environment=”env” />
<property name=”logFolder” value=”${basedir}\logs”/>
<property name=”testFolder” value=”${basedir}\runtest”/>

<property name=”test” value=”**” />
<condition property=”pattern” value=”runtest/*.php”>
<os family=”windows” />


<!– Check Operating system to set phpunit path–>
<target name=”check_os”>
<condition property=”isWindows”>
<os family=”windows” />
<condition property=”isLinux”>
<os family=”unix” />

<target name=”if_windows” depends=”check_os” if=”isWindows”>
<property name=”exe.phpunit” value=”C:\wamp\bin\php\php5.2.9-2\phpunit.bat” />

<target name=”if_unix” depends=”check_os” if=”isLinux”>
<property name=”exe.phpunit” value=”${env.PHP_HOME}/includes/PHPUnit-3.2.0/PHPUnit” />

<target name=”prepare” depends=”if_windows, if_unix”>
<mkdir dir=”${logFolder}”/>

<target name=”phpunit”>
<!– Check if folder empty –>
<fileset id=”fileset.test” dir=”${testFolder}”>
<include name=”*.*”/>
<fail message=”Files not found”>
<resourcecount refid=”fileset.test” when=”less” count=”1″></resourcecount>
<!– Execute phpunit tests –>
<exec executable=”${exe.phpunit}” failonerror=”true” dir=”runtest”>
<arg line=”–verbose –testdox-html ‘${logFolder}/phpunit-report-${TODAY}.html’ –no-syntax-check –filter ${test} AllMyTests” />

<target name=”build” depends=”prepare,phpunit”/>

AllMyTests.php file under “runtest” folder

define(‘PATTERN_OF_TEST_FILES’, ‘-test.php’);


function autoloader_for_tests($c)
$location = getLocationForClassName($c);
if (!empty($location))

class AllMyTests
public static function main()

public static function suite()
ini_set(‘memory_limit’, ‘200M’);

$phpunitsuit = new PHPUnit_Framework_TestSuite(‘PHPUnit Framework’);

$files = new FilterTheDirectory(dirname(__FILE__));

foreach($files as $file_name)

$phpunitsuitName = str_replace(PATTERN_OF_TEST_FILES, ”, $file_name);
return $phpunitsuit;

class FilterTheDirectory extends FilterIterator
public function __construct($path)
parent::__construct(new DirectoryIterator($path));

public function accept()
return strpos($this->getInnerIterator()->getFilename(), PATTERN_OF_TEST_FILES) !== FALSE;

if (!defined(‘PHPUnit_MAIN_METHOD’))

Executing and Creating Selenium RC automation test cases using PHPUnit (by Sebastian Bergmann)

  1. Setup PHPUnit framework assuming PHP 5.2.x is already installed in your system. If not download wamp to install PHP or browse download section to install PHP.
  2. Make sure your PHP path is set in your environment so that you can execute PHP through command prompt. For reference check step 3 and 4 of article and install latest Java JRE (if does not exist on your system).
  3. Download Selenium server and start the server through following command on command prompt
  4. The above steps are explained in
  5. Download and Install latest firefox
  6. Install Firefox Selenium IDE plugin under section Selenium IDE “Download version 1.8.0 released on 24/April/2012”
  7. Install Selenium PHP plugin to generate/export scripts of type PHPUnit framework
  8. Record script through Selenium IDE plugin
  9. Save the test suit and Export test case to PHPUnit framework through Selenium IDE export option under File menu
  10. Open command line and make sure phpunit is working by executing command “phpunit –version”
  11. Open the file which you have exported above in a editor and include the following line-
  12. require_once(‘PHPUnit/Extensions/SeleniumTestCase.php’);
  13. The name of the file (like PhpUnitSelenium.php) and class name should be same i.e. like-
    class PhpUnitSelenium extends PHPUnit_Extensions_SeleniumTestCase
  14. Make sure your selenium running in a command prompt
  15. Now open another command prompt and browse to the directory where you have saved the exported test case file and execute the following command like-
    C:\wamp\www\php-selenium-webdriver\tests>phpunit PhpUnitSelenium
  16. The above should open a new selenium firefox window to execute tests