Selenium Online Training in Hyderabad   Selenium RC is the old version of selenium. It’s powerful but has many issues as well. The core engine of selenium RC is based on JavaScript (like IDE). Selenium RC tool in many languages such as: - Ruby  

 

Selenium Remote Control (RC)

 

 

1. Overview

 

  • While Selenium IDE a productive and efficient tool for write test-cases. it many features of a testing tool

 

  • Conditional statements

 

  • Loops

 

  • Logging

 

  • Exception handling

 

  • Reporting

 

  • Test fixtures and data-driven tests

 

  • Test dependencies

 

  • Taking screenshots

 

  • It follows a client/server model. The allowing client libraries to execute tests on a browser controlled by the server

 

  1.  Selenium Server

 

  • Selenium server is the program that drives the browser

 

  • It embeds Selenium Core framework and injects it into the browser

 

  • It communicates with the running test client and drives the browser

 

  • Client tests sends commands that the server interprets to drive the browser

 

  • The server sends back results to the client

 

 

  • A server is configurable at startup via command-line options. use java -jar selenium-server.jar -h to see the list of options

 

  1. Client libraries

 

  • Client libraries provides the API to program tests and execute them on the server

 

  • Each implementation provides access to all Selenium commands

 

  • Supported API implementation exists in:

 

  • Java (also accessible via Groovy)

 

  • .Net

 

  • PHP

 

  • Python

 

  • Perl

 

  • Ruby

   

4.Lab 3: Installation of Selenium RC

           

           4.1. Prerequisites

 

  • A JVM installed on the system

 

  • A Ruby distribution with the rspec and selenium-client gems installed if

 

  • you’re working

 

  • The Selenium RC archive

 

4.2. Download the Tested Application

 

  • In the folder of your choice, execute the following command: git clone http://github.com/wolframarnold/selenium-test-app.git

 

  • Go to the selenium-test-app folder and run the following

 

  • cp ./vendor/plugins/active_scaffold/test/mock_app/config/database.yml ./config/

 

  • rake db:migrate

 

  • to lauch the application with the script server available in the scripts folder: ./scripts/server

 

  • The application should be available at http://localhost:3000

 

4.3. Running the RC Server

 

  • Unzip the Selenium RC archive somewhere on your system

 

  • Go into the selenium-rc, then the selenium-server folder

 

  • Open a terminal in this folder and enter the command java -jar selenium-server.jar

 

  • If there’s no error message, your Selenium RC server should be running now

 

4.4. Running a Test (Java)

 

  • Create a new Java project in Eclipse or your Java IDE

 

  • Add the selenium-java-client-driver.jar jar to the project’s classpath

 

  • Add a new JUnit test-case to the project. When asked, select Junit 4

 

  • You should now have an empty .java file

 

  • Open the lab2 test-case on Selenium IDE

 

  • On Selenium IDE, open the Options menu then Format… and click Java (Junit)

 

  • Copy/paste the contents in the JUnit file on Eclipse

 

  • Change the package name at your will

 

  • You may have to fix the imports

 

  • Click on the following icon and choose the most appropriate option to correct the file

 

  • press Ctrl + Shift + O to let Eclipse do it

 

  • At this point you shouldn’t have any more errors and you are ready to run the test

 

  • Selenium RC will open a couple of Firefox windows and run the test

 

4.5. Running a Test (Ruby)

 

  • Open the lab2 test-case on Selenium IDE and export it as Ruby (rspec)

 

  • A little workaround need, open the exported file:

 

  • Run the test with spec .rb

 

  • Selenium RC should launch a couple of new browser windows and run the test

   

5.JUnit

 

  • Junit is the reference unit-testing framework for Java

 

  • The framework allows test your applications. classes containing the logic actions on the tested classes and checking the results

 

  • Eclipse provides support for Junit, so we’ll be using that

 

  • JUnit 3 uses named methods to detect set-up and test methods

   

6.RSpec

 

  • RSpec is a Behavior Driven Development framework for Ruby

 

  • It provides a framework that tests your apps according to defined behaviors

 

  • In Behavior Driven Development (BDD), you first define the behaviors of your app. the client’s need write the tests confirm behaviors and start to develop application

 

  • It is Agile-oriented

 

  • Behaviors spec file containing set-up methods. the methods providing tests for a given behavior

 

  • run tests with the spec command in a terminal

   

7.JavaScript

   

  • Selenium works based on JavaScript, you can use it in your tests

 

  • It is an excellent way to extract information from the pages for later reuse

 

  • There are 2 methods available:

 

  • getEval(script): it takes the script as a string. Executes it and return the value to which the script evaluates too. In ruby use get_eval or js_eval

 

  • runScript(script): it actually adds a