Selenium Introduction

What is Selenium

Selenium is an open source tool used for test automation. It is mainly used for automating web application. Selenium is a suite of tools:

1.Selenium 2.0 (WebDriver): It is the current product being used in industries. It has become more powerful and robust automation tool.Selenium 2 still runs Selenium 1’s Selenium RC interface for backwards compatibility.

2.Selenium 1.0( Selenium RC or Remote Control): Selenium RC was the main tool used for automation before WebDriver came into picture. Now, It is depricated and mostly used in maintenance projects.

3.Selenium IDE: Selenium IDE (Integrated Development Environment) is a Firefox plugin and has capability of record and playback the activity performed on any web Application.

4.Selenium GRID: It is used to run the multiple test parallels. It can run the test on different browser and different remote machines.

Languages supported in Selenium:

  1. Java
  2. C#
  3. Python
  4. Ruby
  5. PHP
  6. Perl
  7. JavaScript
Selenium WebDriver:

  1. Google Chrome
  2. Internet Explorer 6, 7, 8, 9, 10 – 32 and 64-bit where applicable
  3. Firefox: latest ESR, previous ESR, current release, one previous release
  4. Safari
  5. Opera
  6. HtmlUnit
  7. phantomjs
  8. Android (with Selendroid or appium)
  9. iOS (with ios-driver or appium)
Operating Systems:

  1. Windows
  2. Linux
  3. Mac
Different forms of Selenium

There are three flavor’s of selenium available for for automation

Selenium IDE

  1. Selenium-IDE is a Firefox add-on and provides an easy-to-use interface for developing and running individual test cases or entire test suites.
  2. It is the Integrated Development Environment for building Selenium test cases.
  3. IDE has a recording and playback feature
  4. Selenium IDE allow to run one testcase at a time or full suite
  5. 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.
  6. Selenium-IDE also offers full editing of test cases for more precision and control.
  7. 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.
  8. Through selenium IDE we can record any application and see the code in any scripting language like Perl, C, Java etc..
  9. Selenium IDE also displays the test results (i.e; Runs & Pass/Fail etc…)
  10. It has Log refrence to verify the errors
  11. It also have “command” feature in which it prompts all the commands present in Selenium
  12. Setting of speed for executing the test scripts is one of the advantage of IDE

Selenium RC

  1. Selenium-RC allows the test automation with any programming language for maximum flexibility and extensibility in developing test logic.
  2. 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.
  3. Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby.
  4. Selenium RC server accepts the commands through HTTP GET/POST requests
Selenium GRID
  1. Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be run in multiple environments.
  2. With Selenium-Grid, multiple instances of Selenium-RC are running on various operating system and browser configurations;
  3. Each of these when launching register with a hub.
  4. 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.
  5. This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.
Why Webdriver??
  1. Comparison between Selenium RC & Selenium WebDriver:
  2. Selenium RC requires to start Selenium Server before executing the programs where as Webdriver does not need server to start.
  3. Selenium RC does Not support advanced functionalities like Drag and Drop, Frames etc. where asWebdriver supports Android and Iphone platforms
  4. Selenium Webdriver can Handle rich API
  5. Selenium Webdriver Can handle Mouse movements even
  6. Selenium RC needs proxy server to execute automated steps where as Webdriver directly interacts with http of application
  7. Selenium WebDriver support’s all the Latest Versions of Firefox
  8. The future of Selenium is Webdriver , hence all future enhancements can be done in Webdriver only.
Webdriver Browsers Support:
  1. InternetExplorer
  2. Firefox
  3. Chrome
  4. Opera
  5. Android

For more information visit

http://seleniumhq.org/about/platforms.html

Setup for Selenium WebDriver:

  1. Download Eclipse from http://www.eclipse.org/downloads/Need: To set up new project for application, to write Automation test steps, to integrate various plugins for Reporting, Auto Triggering etc
  2. Download jar files from http://seleniumhq.org/download/
  3. Ensure Java is already installed on your system & environment variables set correctly. If not download from http://www.java.com/en/download/index.jsp

Selenium is a suite of tools to automate browsers. It is for automating web applications for testing purposes.

Selenium is not just a single tool but it is suite of software tools. It has four component

Selenium Integrated Development Environment (IDE) Selenium Remote Control (RC) WebDriver Selenium Grid

i).Test management Tools: These tools managing requirements, planning tests,preparing tests, providing interface for executing tests,tracking and report defects. Quantitative analysis related to tests and test objects can be easily obtained Ex: Quality centre, Silk Central, Rational quality manager

ii).Requirement management tools: Stores requirement statements checks for consistency and undefined requirements, allow prioritization and traceability requirementsEx: Rational requiste priority

iii).Test Incident management tools: Stores and managers incident reports (i.e defects, failures, problems, faults)Ex: Bugzilla, Rational clear quest

iv).Configuration management tools: Not exactly testing tools, however they are needed to keep track of different versions & builds of the software testsEx: Rational clear case

Static Testing tools: They provide a cost effective way of finding more defects at an earlier stage in the development process. It is used by developers.

These are classified as

i. Review tools

ii. Static analysis tools

iii. Modelling tools

i).Review tools: Assists with review process, check lists, guidelines and are used to store and report defect

ii).Static analysis tools:It helps developers and testers find defects prior to dynamic testing by providing support for enforcing coding standards Ex: J-Test

iii) Modelling tools:Use to validate software tools.These tools can often aid in generating some test cases on the model Ex: physical data model (PDM)for relational database

Test specification tools

i. Test design tools

ii. Test data preparation tools

i) Test design tools:It is used to generate test inputs or executable tests and test oracles from requirements, graphical user interfaces, and design tools

ii) Test data preparation tools: Used to manipulate databases,files or data,transmissions to setup test data to be used during the execution of tests to ensure security.

Test execution and logging tools

I. Test Execution tools

II. Test Harness/unit

III. Test Comparators

IV. Coverage measurement tools

V. Security tools

i) Test Execution tools:Used at all levels of testing, to run and check the outcome of tests which reduces costs, run more tests,make tests are more repeatable. Generally used for automate regression testsEx: QTP,Winrunner,RFT, Selenium

ii) Test Harness/Unit tools:A unit Test Harness or framework facilitates the testing of components or paths of a system by simulating the environment in which that test object will run, through the provision of objects as stubs or drivers

iii) Test Comparator tools:Test Comparators determine the differences between files, databases or test results

iv)Coverage measurement tools:Measure the percentage of specific types of code structures that have been exercised by set of tests

v)Security tools:Used to evaluate the security characteristics of software. This includes evaluating the ability of the software to project data confidentially, integrity, Authentication, Authorization

Performance and monitoring tools

i). Dynamic analysis tools

ii). Performance testing/Stress Testing/load testing

iii). Monitoring tools

i)Dynamic tools: These tools find defects are evident only when software is executing such as primary dependencies or memory leaks. They are typically used in components and component Integration testing

ii) Performance testing tools:It is used by testers. It is used to monitor and report on how a system behaves under a variety of stimulated usage conditions in terms of number of concurrent users.

iii)Monitoring tools:Used to analyze, verify and report on usage of specific system resources and give warnings of possible service problems.