Selenium Tutorial for Beginner


Selenium Tutorial for Beginner
1) Introducing Selenium
> Selenium is a suite of software tools to automate Web browsers.

(It is not a single tool like UFT, RFT, SilkTest etc..., Selenium automates web based applications only, It doesn't automate Desktop applications

UFT(formerly QTP) can automate Desktop and Web applications.)

> It is open source software.

(Anybody can download and use Selenium suite of tools with free of cost, but UFT, RFT etc... are Vendor tools)

> Selenium supports various operating environments.

Windows

UNIX

Macintosh etc...

(UFT / QTP supports Windows operating environment only)

> Selenium supports various browsers,

Mozilla Firefox

Google chrome

MS Internet Explorer

Opera

Safari etc...

> Selenium supports various programming languages to enhance Test cases.

Java,

C#

Perl

Python

PHP

Ruby
-----
Use Java programming for Selenium

(We can use anyone supporting programming language for enhancing test cases, Select Java Language.

Why Java for Selenium?

Most of the Selenium developers (nearly 77%) use Java and more help documentation and implementations available for java.
-------------------------------------
Select Selenium WebDriver + Java programming (Core Java- Java Fundamentals and OOPS) + TestNG Framework.

i) Selenium WebDriver -for identifying elements (objects) and performing operations on elements.

ii) Java programming - for enhancing Test cases

iii) TestNG - for Providing Test reports, grouping Test cases, Data driven Testing and parallel test execution.
--------------------------------------------------------

2) History of selenium Project
> Selenium first came to life in 2004

> WebDriver interface was launched at Google in 2006.

> In 2008, WebDriver merged with Selenium RC, called as Selenium 2.0

Selenium IDE + Selenium RC + Selenium Grid - Selenium 1.0

Selenium IDE + Selenium RC + Selenium WebDriver + Selenium Grid - Selenium 2.0

----------------------------------------------
3) Selenium License
All Selenium projects released under the license of Apache 2.0

> Anybody can download and use all selenium tools with free of cost.

> Anybody can modify the source code.

> Anybody can distribute the source code.

* Selling the modified code is not allowed.
--------------------------------------------------

4) Selenium supporting Platforms / Environments.
a) Application Environment
> It doesn't support CUI based Application

> It doesn't support I-tier and II-Tier Applications (Desktop or Windows based Applications)

> It supports web Applications (III-Tier to N-Tier)

> It supports Mobile Applications which are having web forms.

b) Operating Environment
> It supports MS Windows operating environment

> It supports UNIX operating environment

> It supports Mac operating environment

c) Web Browsers
> Supports Mozilla Firefox

> Supports IE

> Supports Google Chrome

> Safari

> Opera etc...

d) Programming languages
Java,

C#

PHP

Perl

Python

Ruby
--------------------------------------
5) Selenium Suite of Tools / Selenium Components
a) Selenium IDE

b) Selenium RC (* Out dated)

c) Selenium WebDriver

d) Selenium Grid
-------------------------
a) Selenium IDE
> It is a Firefox plug in.

> It is prototyping tool.
------------------------------
Features of Selenium IDE:
> Record and Playback Test Cases

> Type Test cases/test scripts using element locators and Selenese commands / Selenium IDE commands

> Edit Test Cases

> Execute test suites.

> debugging Test cases

> Export test cases to other formats (programming languages)

* Selenium IDE Test case format is .html
----------------------------------------
Drawbacks of Selenium IDE:
> It supports Firefox browser only.

> It is prototyping tool, not suitable for complex test cases.

> No Programming support (No conditional and Loop statements etc...)

> Data Driven Testing is not possible.

> No detailed Test Reports (It provides summary only)
-------------------------------------------
b) Selenium RC (* Out Dated)
c) Selenium WebDriver
It is a Programming Interface, (It doesn't have IDE)

WebDriver features:

> Create Test Cases / Test scripts using Element locators and Methods

> It supports Conditional and Loop statements
(Variables, Operators, Arrays, strings, Methods, Flow control statements, Methods, and OOPS concepts)

> It supports Java, C#, Perl, Python, Ruby and PHP languages for enhancing Test cases.

> Data driver testing is possible.

> Cross browser testing is possible.

Etc...

Drawbacks

It doesn't generate Test reports.
---------------------
d) Selenium Grid
Selenium Grid 2.0 supports Selenium WebDriver test cases.

> It is used to grouping Test cases.

> It is used to execute Test cases in parallel

> Generate Test Reports.
----------------------------------------

6) Selenium versus UFT
Selenium
i) Open Source, No license cost

ii) Selenium supports Web Application only

iii) Supports Firefox, IE, Chrome, Safari Opera etc...

iv) Supports Java, C#, PHP, Perl, Python and Ruby.

v) Use Element locators

vi) Supports Windows, UNIX and Macintosh etc...

vii) Limited support for Image testing.

viii) Difficult to use.

ix) No reliable Technical support.

x) New features may not work properly.

xi) No Object Repository, so no centralized maintenance of objects (elements)

xii) No authorized certification.

xiii) No integration with other tools
---------------------------------------
UFT (Formerly QTP)
i) Vendor tool (HP), License

ii) Supports Desktop/windows based and Web Applications

iii) IE, Firefox and Chrome.
   
iv) VBScript only

v) Based on add ins

vi) MS Windows operating environment only.
   
vii) Rich support for Image Testing

viii) Easy to use.

ix) HP provides Technical support

x) New features will work properly.

xi) Centralized maintenance of Objects

xii) HP conducts certification exam

xiii) UFT can be integrated with ALM/QC for Test Management
--------------------------------------
UFT                     Selenium
Test/Test script    Test Case / Test Script
Object                 Element
Property              Locator
----------------------------------------------
7) Frameworks and plug ins used in Selenium
a) Frameworks
i) JUint
> It is a framework for Unit testing and it can be used for selenium Functional tests also

> It is used to execute test batches and generate Test reports.
----------------
TestNG
> Grouping Test cases and Execute test groups.

> generate HTML test reports

> Parallel Test execution

> Executing multiple programs / classes using XML file.
-----------------------------------------
Plug ins used in selenium
i) Firebug and Firepath  for inspecting elements, It is for Firefox browser.

Note: For IE and Google Chrome built in developers tools available (F12)
-------------------------------------------------------
Edit box - Element / Object

id - Locator

Email - Value

Method / Operation - Entering a Value (ex: gcrindia@gmail.com)
---------------------------------
Man - Object / Element

Name - locator

Rovil - Value
----------------------------------
8) Advantages of Selenium
> It is open source, anybody can download and use.

> It supports various programming languages for enhancing Test cases.

> It supports various operating environments

> It supports Parallel test execution

> It supports various browsers

> It uses less hardware resources.
---------------------------------------
9) Disadvantages of selenium
> Since it is Open source software, no reliable technical support.

> It doesn't support Desktop Applications.

> Limited support for Image Testing

> No centralized maintenance of elements/objects

> Difficult to use when it compares to Vendor tools (Ex: UFT, RFT etc...)

> New features may not work properly.

> No integration with other tools for Test management
-----------------------------------------------------
10) Choose Selenium Tools
Choose Selenium IDE (If you don't have programming knowledge)

Or

Choose selenium Webdriver (If you have programming knowledge)

Choose Java for programming.

Firebug and Firepath plug ins to inspect elements for Firefox browser

* If it is IE or Chrome built-in developer tools available (F12)

TestNG Framework to execute Test batches and Generate Test reports
-------------------------------------
11) Configure Selenium
Java, Selenium WebDriver, TestNG

> Download and Java (JDK) and Install

> Set Environment (Path) variable path to access Java software from any directory.

> Download Eclipse IDE (To write and execute Java programs)

> Download and Install WebDriver (Java bindings) from www.selniumhq.com and add Webdriver jar files to Java project (in Eclipse)

> Download and install Firebug and Firepath plug ins to inspect elements in Firefox browser

> Download IE, Chrome etc... Browsers drivers (If you want execute test cases on IE and Chrome browsers)

Note: Firefox browser driver is built- in in Selenium Webdriver.

> Download and install TestNg from Eclipse IDE.
-----------------------------------------------

0 comments:

Post a Comment