Selenium RC configuration for java – all in a nutshell

What do we need to get started with selenium RC?

Configuration of Selenium RC test automation framework with Java client driver is not that simple as it requires the installation of so many packages and it takes a die-hard effort to get all the required information on getting started at one place. It’s sometimes boring and you might ask yourself “Is this the only way to get started?“. This article is not a shortcut but still presents all in a nutshell on how to get started with selenium RC. The below nutshell picture portrays all the software packages needed to set up Selenium RC for java. So now lets get started on the long road of setting up our test automation framework using selenium RC and java.

Below are the step-by-step instructions for the installation and configuration of Selenium RC for java client driver on ubuntu platform. To start selenium server we need JAVA. So, let’s start with the installation of java.

Installation of java and setting class path:

Download Java JDK from the below path: http://www.oracle.com/technetwork/java/javase/downloads/index.html

To find the exact path where java is installed give the below command:

which java

OUTPUT: /usr/bin/java Then set the path for JDK using the below commands:

export PATH=$PATH:/usr/bin/java
export JAVA_HOME=/usr/bin/java

To check whether java path is set properly give the below command

java -version

It should display the version of the Java installed.

Installation of selenium RC with java client driver:

Selenium Server: This is required to run the Selenium RC style scripts. Download and extract the selenium server jar file from: http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.0rc2.jar&can=2&q=

Selenium Client Driver for java: To create scripts that interact with the Selenium Server we need the selenium client driver. There are language-specific client drivers for ruby,c# and so on. Let us install the selenium client driver for java. Download the client-driver for the programming language java: http://seleniumhq.org/download/

Installation of ant:

Install ant on ubuntu using the below command

sudo apt-get install ant ant-optional

To find where ant has been installed give the below command:

which ant

Set the path of ant using the PATH variable as below:

export PATH=$PATH:/usr/bin/ant

Installation of Eclipse:

Install eclipse in ubuntu using the below command:

sudo apt-get install eclipse

TestNG plugin for eclipse:

1. Open eclipse. 2. Click Help → Install New Software.. 3. Then click on Available Software Sites link 4. Click on the Add button. Enter the site url as http://beust.com/eclipse to add TestNG plugin to eclipse. Now the TestNG plugin for eclipse is added as below:

Installation and configuration of TestNG on ubuntu:

The below command installs TestNG on ubuntu:

git clone git://github.com/cbeust/testng.git

Building TestNG with ant: Download cobertura-1.9.4.1-bin.zip from the below site into the home directory http://cobertura.sourceforge.net/download.html unzip using the below command:

unzip cobertura-1.9.4.1-bin.zip

Now navigate to the testng directory. Copy ivy-2.1.0.jar into /ant/lib directory as shown below:

sudo cp ivy-2.1.0.jar /usr/share/ant/lib

Now give ant command in the testng directory:

ant

The OUTPUT should be BUILD SUCCESSFUL.


Now we have installed all that we need to get started with Selenium RC using the client driver for java. In the next article, we will create a test suite using this setup.

RVM – Easy installation of ‘ruby on rails’ on ubuntu

Ruby Version Manager (RVM) resolves versions conflicts when multiple versions of ruby is installed on the same system. It also enables quick and easy installation of ruby on rails on ubuntu. This article provides solution to the problems faced during the installation of ruby on rails on ubuntu using RVM.

Installation of RVM:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
source ~/.rvm/scripts/rvm
rvm reload

Install Ruby 1.9.2 with rvm:

rvm package install zlib
rvm install 1.9.2 -C --with-zlib-dir=$rvm_path/usr
rvm install 1.8.7-p174 -C –with-zlib-dir=$rvm_path/usr

To resolve version conflict, create separate gemsets for each of the two different versions:

rvm --create 1.8.7-p174@rails2tutorial
rvm --create use 1.9.2@rails3tutorial

To use Ruby 1.9.2 by default and Rails 3.0 give the below command:

rvm --default use 1.9.2@rails3tutorial

Install Rails:

gem install --no-ri --no-rdoc --version=3.0.1 rails

Confirm installation with the below command. This command will display the version of rails installed on the system.

rails -v

Install RubyGems:
Installation of rvm automatically installs RubyGems
Give the below command to confirm this. This command would display the path in which the gem has been installed.

which gem

Update the system to the latest version with the below command:

gem update –system