November 19, 2010

Selenium Basics Part - 1

Here i am going to explain you basics of selenium. 

To Automate or Not to Automate? That is the Question!

Is automation always advantageous? When should one decide to automate test cases?
It is not always advantageous to automate test cases. There are times when manual testing may be more appropriate.
However, automation has specific advantages for improving the long-term efficiency of a software team’s testing processes. Test automation supports:
  • Frequent regression testing
  • Rapid feedback to developers during the development process
  • Virtually unlimited iterations of test case execution
  • Customized reporting of application defects
  • Support for Agile and eXtreme development methodologies
  • Disciplined documentation of test cases
  • Finding defects missed by manual testing
Introducing Selenium
Selenium is a robust set of tools that supports rapid development of test automation for web-based applications. Selenium provides a rich set of testing functions specifically geared to the needs of testing of a web application. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior.
One of Selenium’s key features is the support for executing one’s tests on multiple browser platforms.

What is selenium?
Selenium is a suite of tools to automate web app testing across many platforms.
Selenium...runs in many browsers and operating systems. Can be controlled by many programming languages and testing frameworks.

Selenium Components
Selenium is composed of three major tools. Each one has a specific role in aiding the development of web application test automation.

Selenium-IDE is the Integrated Development Environment for building Selenium test cases. It operates as a Firefox add-on and provides an easy-to-use interface for developing and running individual test cases or entire test suites. Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back. It also has a context menu (right-click) integrated with the Firefox browser, which allows the user to pick from a list of assertions and verifications for the selected location. Selenium-IDE also offers full editing of test cases for more precision and control.
Although Selenium-IDE is a Firefox only add-on, tests created in it can also be run against other browsers by using Selenium-RC and specifying the name of the test suite on the command line.

Selenium-RC (Remote Control)
Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test logic. For instance, if the application under test returns a result set, and if the automated test program needs to run tests on each element in the result set, the programming language’s iteration support can be used to iterate through the result set, calling Selenium commands to run tests on each item.
Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC with a high-level programming language to develop test cases also allows the automated testing to be integrated with a project’s automated build environment.

Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be run in multiple environments. With Selenium-Grid, multiple instances of Selenium-RC are running on various operating system and browser configurations; Each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch the browser and run the test. This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.

 How it works