Home Java Overview Maven Tutorials

Saturday 11 May 2019

Introduction of Selenium & Architechture

Introduction of Selenium

History of selenium
In 2004, Jason Huggins, an engineer at Throghtworks(Chicago) was working on a web Application that required frequent testing.
Manual testing was becoming hard as it was time-consuming and inefficient.
He wrote a Javascript program that could interact with the browser and do actions.
He called it "Javascript Test Runner"
He started giving demos about this tool and soon there were discussions to make it open source as a re-usable testing framework.
but some how , there was Same Original Policy Issue
What is Same Origin Policy Issue ?

The same origin policy is an important concept in the web application information security domain.
In this Policy, a web browser allows scripts contained in a first web page "A" to access data/resources in a second web Page "B", however, only if both web pages have the same origin.

To come out from this problem Paul Hammant started to work on it
After Jason Huggins started giving demo of JavaScriptTestRunner, Paul Hammant another Throughtworks engineer started working to overcome the Same Origin Policy Issue.
He(and his team) added a server that will act as http proxy to trick the browser to believe that selenium core and web application being tested , come from the same domain.
This came to be known as : Selenium Remote Control(RC)
In 2004 selenium become open source.
In 2006 the enhanced Selenium RC completely took over Selenium Core and released as Selenium 1.
In 2006, Shinya Kasatani(Japan) Created a Firefox extension that can enable record and replay of browser actions.
He named it Selenium IDE.
He donated it to the selenium project in 2006.

In 2006, Simon Stewart, another Thoughtworks engineer started working on a project to create another testing tool to overcome some limitation of selenium 1.
He called it WebDriver.
At the same time Jason Huggins left Thoughtworks to join google where he continued his work on Selenium 1.

in 2011 the 2 tools merged to form Selenium 2.0 and was released on July, 2011.

In 2007, Philippe Hanrigou, then at ThoughtWorks made a server tool to enable parallel execution of selenium tests across multiple machines.
This was named as Selenium Grid.

Selenium Grid extends Selenium RC and enables running tests on multiple servers in parallel, saving running tests on multiple servers in parallel, saving time and cost.

Selenium Grid was released at end of 2007.

WebDriver's doubt in 2007 fuelled a desire for features that were not available in Selenium 1 that time
In 2011 the 2 projects were merged and Selenium 2.0 was born and released in July 2011.

All Seleniu RC(Core) implementation is replaced with webdriver compatible components.

Last stable release of Selenium 2 was 2.53.1
Selenium RC no longer available for download from SeleniumHQ site.

To get older releases

What is Selenium ?
Features of Selenium
4 Components of Selenium
Browsers |OS | Languages
What is selenium
Selenium is a set of tools and libraries that automates web browser actions.
In other words "Selenium provides tools that can interact with browser and can automate browser actions like click, input, select, navigate etc. with the help of scripts.

Actually , we use to do three things in selenium :-
1). Iidentify Web Elements (Using identifiers like id, xpath etc.)
2). Add Actions (Using own preferred programming language) with Test data.
3). Run and validate Data.

Note :- 1). Selenium is not a tool but a library of tools.

2). Selenium is free and open Source.

Features of Selenium
Flexible and Extensible
Multiple Programming Languages Supported
Multiple Browsers Supported

Four Components of Selenium 1). Selenium IDE
Selenium IDE is a Firefox add-on & a Record and playback plugin, Useful for quick prototype testing

2). Selenium RC (Remove Control)
Also known as Selenium 1, used to execute scripts(written in any language) usiing java script.
Now Selenium 1 is deprecated and is not actively supported.

3). WebDriver
An API used to send commands directly to the browser. It is a successor to Selenium RC.
Selenium RC and WebDriver are merged to form Selenium 2.

4). Selenium Grid
for parallel and distributed execution
A tool to run tests in parallel across different machines and different browsers simultaneously.
Used to minimize execution time.

Selenium was created by Jason Huggins
Selenium IDE created by Shinya Kasatani
Selenium RC created by Paul Hammant
Selenium WebDriver created by Simon Stewart
Selenium Grid created by Patrick Lightbody

Browsers Supported by the Selenium
Internet Explorer

Operating System Supported by the Selenium
Mac OS

Programming Languages Supported by the Selenium

Introduction of Selenium & Architecture

What is selenium :- Selenium is an open source tool which is used to automating the tests carried out on web browsers.
In other words Selenium is an open source tool to automate the browser only.
Always remember only testing of web application is possible with selenium.
Also we can neither test any desktop application(Software) nor test any mobile application using selenium.
But there are many tools for testing software and mobile applications like IBM's RFT, HP'QTP, Appium etc.

Since Selenium is an open-source, there is no liecensing cost involved, which is a major advantage over other testing tools.
Selenium is now a day's getting popularity due to following reasons :-
1). Test scripts can be written in any of there programming languages :- Java,Phython,C#,PHP,RUBY,Perl,.Net,etc.
2). Tests can be carried out in any of these OS: Windows, Mac, or Linux
3). Tests can be carried out using any browser like HtmlUnit, Mozilla firefox, Internet Explorer, Google chrome, Safari or Opera.
4). It can be integrated with tools such as TestNG & JUNIT for managing test cases and generating reports.
5). It can be integrated with Maven, Jenkins & Docker to achieve Continuous Integration Testing.

Limitation of selenium :- 1). There is no support available for selenium. We need to leverage on the available customer communities.
2). We can use selenium only to test web applications. We can not test desktop applications or any other software.
3). There is no native reporting facility but we can overcome that issue by integrating iy with frameworks like TestNG&JUnit
4). It is not possible to perform testing on images. we need to integrate selenium with sikuli for image based testing.
Architecture of selenium
This wire protocol defines a REStFUL (REpresentational State Transfer) web services using JSON over HTTP.
JSON :- Java Script Object Notation
Http :- HyperText Transfer Protocol

What a tester needs to do in selenium
1).Identify web Elements, using identifiers like id, xpath etc.
2).Add Actions, usiing your preferred programming language along with the test data.
3).and finally run the test.

Selenium Hierarchy

Explanation :- SearchContext is the super most interface in selenium, which is extended by another interface called WebDriver.
All the abstract methods of SearchContext and WebDriver interfaces are implemented in RemoteWebDriver class.
All the browser related classes such as FirefoxDriver, ChromeDriver etc., extends the RemoteWebdriver class.

No comments:

Post a Comment