Selenium Tutorial 2

Selenium Tutorial 2

Overview of Selenium Part-2

vii) Frameworks used in Selenium:

a) JUnit:

It is framework for Unit testing,

It can be used for Selenium functional tests also

JUnit is used to execute Test batches and generating Reports

b) TestNg:

It is used to execute Test batches and generating reports

It is has built in HTML, XLM Reports
viii) Advantages of Selenium
> It is open source tool, we can download use

> It supports various operating environments (Windows, UNIX, Mac etc...)

> It supports various programming languages to create and execute Tests

> It supports all popular web browsers

> It supports parallel test execution

> It uses less Hardware resources
ix) Disadvantages of selenium
> Since it is open source tool, No reliable Technical support
(Official Users Group, Chat room in

> It doesn't support Desktop Applications/Windows bases applications

> No Other tool integration for Test management

> Difficult to use

> New features may not work properly

> Deployment of selenium is difficult than UFT and RFT tools
x) Choose Selenium Tools

Choose Selenium IDE (If you don't have programming knowledge)
WebDriver (If you have programming knowledge)

Java Programming Language

WebDriver with Java

Firebug and Firepath Add ons for inspecting UI elements

TestNG Framework to execute Test batches and generating Test Reports.
xi) Configure Selenium 

 > Download and Install Java (JDK)

> Download and Install Eclipse (To write and Execute Java programs)

> Download WebDriver Interface (Java bindings) from and deploy in Eclipse

> Download and install Firebug and Firepath in Mozilla browser

> Download and install TestNg framework
Software Test Process/STLC    Test Planning
    Test Design
    Test Execution
    Test Closure   
UFT Test Process    

    Generating Basic Tests
    Enhancing Tests
    Running and Debugging Tests
    Analyzing Test Results
    Reporting Defects
Session 3: Selenium Test Process
Phase I: Test Planning
> Get Application Environment details (UI design, and Database) from development team

> Analyze the AUT in terms of UI elements Identification

        Using Selenium IDE Recording feature
        Using Firebug (It can be used to inspect UI elements)

> Select Test cases for Automation

    Tests that we have to execute on every build (Sanity tests)
    Tests that we have to execute on every modified build(Regression Tests)
    Tests that we have execute using multiple sets of Test data (Data Driven Tests)

> Select Framework (TestNG) and configure
Phase II) Generating Basic Tests

a) Object Repository based Test Design (Recording, Keyword driven methodology)

b) Descriptive Programming (Static, Dynamic Programming)
In Selenium:

a) Using Recording feature in Selenium IDE / Type Test scripts using UI elements locators and Selenium commands

b) Write Test scripts using UI elements locators in Selenium RC(Out dated)

c) Write Test scripts using UI elements locators in WebDriver interface

Note: In Selenium no object Repository, so no centralized maintenance of Objects/UI Elements

Phase III : Enhancing Tests

Insert Verification points

Add comments



Working with files

Error handling


Phase IV: Running and Debugging Tests
Single Test Run

Batch Testing
    Using JUnit or TestNg frameworks we can execute Test batches

Debugging Tests

> Locating and Isolating Errors thru step by step execution

> Debugging is not required for all tests.

> Whenever Test is not showing any errors and not providing correct output

Phase V: Analyzing Test Result 

Status of Test Result in Functional Test Automation

Pass (If expected result = Actual Result)

Fail (If expected result <> Actual Result)

Done (Test execution without errors, No verifications)

Warning (Interruption during test execution)

Define Test Result:

WebDriver doesn't have any Built-in Test report generator

Using programmatic statements we can generate test Results

Using TestNg we can generate Test Reports

Phase VI: Reporting Defects
Functional Test Automation        Defect Management
Selenium                 Manual (No tool support)
Selenium                Bugzilla or any tool
Session 4: Java Language for Selenium 

Why Java for Selenium?
> Selenium written in Java, it doesn't mean that Java only more compatible with selenium, we can use other supported languages also.

> Good support for Selenium with Java, You can get more help documents and implementations from Internet.

> Majority of Selenium Testers(nearly 77%) using Java, so knowledge sharing is very easy.

> Java is platform independent language, we can use it on any Operating environment.

How much Java is required for Selenium?
> For Test Automation using Selenium Core Java knowledge is sufficient, Advanced Java not required.

> Java Basics and Object Oriented Concepts are required.

We can segregate Java for Selenium into 2 categories.

A) Java Basics
B) Java Object Oriented Programming
a) Overview on Java

> Java Programming Language was developed by Sun Microsystems in 1995, Now it is subsidiary of Oracle corporation.

> Java is an Object Oriented programming Language, In Java, everything is an Object. Java can be easily extended since it is based on the Object model.

> Java is a Platform independent Language. It can be compiled and interpreted.

> Java is Simple, It is easy to learn and implement.

> java is Securable, using Java we can develop virus free and tamper free systems.

b) Java Environment Setup

We have to setup java environment to write and execute Java programs, It varies from one operating system to another.

> If it is DOS (from Command prompt in Windows), install java Software(JDK) and set Environment variables.

> If it is Windows GUI, install Java and Eclipse(Java Editor) to write and execute Java programs

c) Java Syntax

> Java is case sensitive language(deference is there in between upper and lower case letters)

Ex: Identifiers UFT and uft have different meaning in java

> First letter of a Class Name should be in upper case.

> Method names should start with lower case letter

> Java Program file name should exactly match with class name.

> public static void main (String args[])- Java program execution starts from main method, which is mandatory in every java program.

> Every statement should end with semi colon symbol.

d) Usage of Java

> Developing Desktop Applications (Ex: Acrobat Reader)

> Developing Web Applications

> Developing Enterprise Applications (ex: banking, Insurance Applications)

> developing mobile applications

> Embedded systems

> smart cards

> Games etc...
A) java Basics

i) Comments in Java 

Purpose of comments

    > To make the code readable
    > To make the Disable from execution

Java supports Single line comment and multiple lines comment.

ii) Data Types in Java
There are two categories of Data types in Java

a) Primitive data types

b) Reference data types

iii) Variables
a) Local variables

b) Instance variables

c) Class / Static variables

iv) Java Modifiers
Modifiers are used to set access levels for Classes, variables, methods etc...

a) Access Modifiers (Default, Public, Private, Protected)

b) Non-access Modifiers (Static, Final, Abstract, Synchronized)

v) Operators in java
Operators are used to perform mathematical, comparison and logical operations.

Categories of operators:

a) Arithmetic

b) Relational operators

c) Bitwise operators

d) Logical operators

e) Assignment operators

f) Mise Operators

vi) Conditional statements
Used to insert verification points and for error handling.

Types of conditional statements in Java:

a) If Statement

b) Switch statement

Types of Condition:

a) Single condition

b) Compound conditions

c) Nested conditions

Usage of conditional statements:

a) Executing a block of statements when condition is true.

b) Execute a block of statements when condition is true otherwise execute another block of statements.

c) Decide among several alternates (Else if)

d) Executing a block of statements when more than one condition is true.(Nested if)

e) Decide among several alternates (Switch statement)

vii) Loop statements
used for repetitive execution.

Types of Loop Statements

a) For Loop

b) While Loop

c) Do...While Loop

d) Enhanced For Loop (mainly used for Arrays)

Selenium Tutorial 3


Post a Comment