CodeX
Published in

CodeX

An approach to automate the testing across web browsers using SELENIUM.

Photo by Christopher Gower on Unsplash

Before focusing on test automation, we should have an understanding of manual testing and its limitations. Manual testing is a primitive method of software testing. It involves physical methods of executing the test cases to identify defects without the help of automation tools.

So, what are the limitations of manual testing?

The tester can only focus on one verification point at a time, so that, the scope of the test is limited. And also, the accuracy of the tests is low because human error is bound to occur. There is a high risk of errors with manual testing. Manual testing is also a time-consuming method because the tester has to create manual reports, logs, and repositories manually. On the other hand, performance testing and batch testing cannot be successfully done manually.

Therefore, test automation is required to speed up a test with less error and to execute it more frequently. That’s when ‘Selenium’ comes on stage.

What is Selenium?

Selenium is an open-source automated testing tool for web applications carried out on various browsers and platforms. It is primarily developed in Javascript and the test scripts can be written using multiple programming languages such as C#, Java, Python, Rubi, etc...

Selenium is consisting of a set of tools to facilitate testing as follows.

  • Selenium Integrated Development Environment (IDE)

Selenium IDE is a Firefox add-on that is used to build automated test scripts. It is the simplest tool in the selenium suite as it consists of an easy-to-use interface. Because of that, it can be used as a prototyping tool instead of using it for building complete test cases. The functionality of Selenium IDE is recording user interactions on the browser and exporting them as a reusable script. The test cases can be recorded as,

.java for java

.cs for C#

.py for python

.rb for Ruby

The autocomplete mode of Selenium supports the tester to enter commands more quickly and restricts entering invalid commands. Debugging the scripts, provision of control flow statements, re-usability, locator functionality and Selenium side-runner are the advancements of Selenium IDE.

-Limitations of Selenium IDE

Selenium IDE is unable to provide detailed test reports. And also the script cannot be exported to WebDriver scripts. Unlike Selenium Web Driver, database testing and data-driven testing cannot be performed with the IDE.

  • Selenium Web Driver

Selenium Web driver was introduced to overcome the limitations of Selenium RC as a cross-platform Selenium RC. It is a web-based automation tool that can be known as a collection of open-source APIs. The test scripts can be written using any supported programming language such as Java, C#, Python, Perl, Ruby, PHP, etc. As the WebDriver is able to make direct calls to the browsers it is much faster than RC. Though Firefox acts as the built-in browser to the web driver, other browsers such as Google Chrome, Opera, Internet Explorer, and Safari can be also used as plugging their specific drivers.

The Selenium WebDriver Architecture consists of four basic components.

  • Selenium Remote Control (RC)

Selenium RC is a testing framework that allows to writing test cases in any programming language (Perl, C#, Java, PHP, Python). It is a jar file that does not require any other special installations. Server and client libraries are the two parts of Selenium IDE. The server act as a mediator between the Selenium command and the browser by accepting commands from the user and passing them to the browser as Selenium-core js commands. Before running test scripts, the Selenium RC server should be installed and launched.

Limitations of Selenium RC

The architecture of the Selenium RC is complicated as it consists of an additional server. It also takes a long time for the execution of commands.

  • Selenium Grid

Selenium Grid is a proxy server that allows running test cases in parallel on multiple machines on various platforms. The two major components of the Selenium Grid are the hub and the node. Here a server is acting as the hub and the commands are routed to remote web browser instances.

The hub directs the JSON test command nodes to remote drives, taking instructions from the web driver client. It can be also known as the local machine that triggers the test cases and distributes them to nodes. Then the nodes execute those test cases and automate the browser.

When considering the Evolution of Selenium, Each version is introduced with these tools respectively

Selenium 1 → Selenium IDE + Selenium RC + Selenium Grid

Selenium 2 → Selenium IDE + Selenium Web Driver + Selenium RC + Selenium Grid

Selenium 3 → Selenium IDE + Selenium Web Drive 7r + Selenium Grid

How to get started with Selenium?

To get started with Selenium, instead of downloading Selenium as a whole, the computer only needs some of its components to run automated browser instances. A language and a framework need to be chosen and then some sample tests can be run on any supported browser.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store