As the software development process changes from waterfall to Agile methodology, it becomes essential to use automation for testing. Reason being now there are frequent productions, so to perform regression testing, it is advisable to use automation.
Automation testing means use an automation tool to execute the test scripts. This reduces the human intervention which result in avoiding any human error as well as reduces the test execution time.
Automation testing is preferable for those test scripts which are executed repeatedly and execution is time consuming.
Saying this, one should keep in mind that we can’t automate everything. The ideal scenario is to automate that part whose ROI (Return of Investment) is higher in terms of automation.
What is Selenium??
First of all, Selenium is not a single automation Tool like QTP, but it is basically a suite of software’s or set of JAR files to automate web browser across various browsers. Selenium is used by many companies, but few to mention are Netflix, Google, HubSpot, Fitbit, and more.
Test Packages of Selenium are:-
1) Selenium IDE (Integrated Development Environment) – It is an add-on feature on Mozilla Firefox and Chrome. It is playback and record tool. You don’t need to know any language for using this tool.
2) Selenium RC (Selenium 1.0) – RC means Remote Control. Selenium RC was the main Selenium project for a long time, before the WebDriver/Selenium merge brought up Selenium 2, the newest and more powerful tool.
3) Selenium Grid – Grid supports parallel execution means multiple test scripts can be executed at the same time on multiple browsers. Selenium Grid supports distributed test execution. So, it will speed up the test execution.
Selenium Grid follows Hub-node architecture. The Hub knows the configuration of each node connected to it. When the Hub receives the information that a test needs to be run along with browser and OS information, then it check for the available node with the same combination and send the Selenium command to that node.
4) Selenium WebDriver – This is the latest version of Selenium. In WebDriver, web elements are identified on web browser and then actions are performed on these web elements. Selenium WebDriver supports testing of dynamic pages where web elements changes without reloading the page.
WebDriver overcomes the problem of single host origin policy which is present in RC.
Now question is what is Single Host Origin Policy ??
This is an important aspect in web application security model. As per this policy, a web browser allows scripts present on first web page to access the data in second web page, provided both the web pages have same origin, means URI scheme, host name and port number are same.
We know that there are a lot of automation tools in market like QTP, RFT (Rational Functional Tester) and so on, then why Selenium is so famous.
1) Open Source – Selenium is open source tool means no associated cost of licensing. So, it is very cost effective in the terms of automating the testing.
Selenium supports a range of browsers like Google Chrome, IE, Mozilla, Opera, Microsoft Edge, Safari, Html Driver. It supports different operating systems also such as Windows, MAC, Linux, Android, iOS.
3) Supports Parallel and Cross Browser Testing -Selenium supports parallel test execution. That means we can open multiple browsers at the same time and execute the test cases. This decrease the execution time significantly.
Selenium supports Cross browser test execution. This refers to the fact that we can open different browsers like IE and Chrome and execute the same test cases or different test cases at the same time. This increases the coverage of test execution
Jenkins – It is a continuous integration tool and can be integrated with Selenium. Jenkins is used for automatic test execution . That means whenever there is any change in software, Jenkins allow you to run the tests every time and deploy the changes to new environment when the tests pass. Jenkins is also used for scheduling the tests to run at specific time.
Maven – Maven is build management tool , based on the concept of Page Object Model (POM). It is used to define the structure of project, dependencies, build and test management. POM.xml file contains the information about the version of webdriver. It automatically download the necessary files from repository to local repository.
TestNG – TestNG is an open source automation testing framework. It helps to group and prioritize the test scripts and support data parameterization and reporting feature.
Git– It is an open source version control system. It allows to commit the work locally and then sync the local copy of repository with copy of server.
5) Framework Compatibility – Selenium supports various test automation framework like Data Driven, Keyword or Hybrid. User can select any type of framework depending on the project requirement.
6) Supports mobile Testing – Selenium don’t perform mobile testing. But it supports mobile testing with the help of additional software like Selendroid and Appium. These software’s are based on Selenium, so anyone who is well versed with selenium can apply the same principles for mobile app testing.
7) Supports Database Testing – Selenium WebDriver in itself can’t perform Database Testing, but this can be done by using WebDriver with JDBC (“Java Database Connectivity”) API. The API lets the user connect and interact with the data source and fetch the data with the help of automated queries.
8) System Compatibility – Internet Explorer(IE) and Google Chrome supports both 32 bit and 64 bit version, where you can download and use them based on your system requirement.
9) Selenium 3.0 – In Selenium 3.0, all the vendors like Google, Apple, Microsoft, Firefox have their own drivers to work on Selenium. Selenium 3.0 supports Selenium Grid and Selenium WebDriver and stops using Selenium RC directly. Selenium Core is completely removed from the latest version of Selenium 3.0.
Like any other tool, Selenium also has some limitations, such as:-
1) Programming knowledge is needed – Selenium does not support code less test automation. Tester need to know any one of the programming language which are supported by selenium.
2) No Image Comparison – Selenium doesn’t support image comparison. To perform image comparison, selenium needs to be integrated with a third party tool called – Sikuli
3) No Official Customer Service Support – It’s an open source tool so there is no official customer support team to address your issues. You can get support from tutorial, chat room, online support, but not from product creators.
4) No Reporting facility – The lack of automation report generation is one of the biggest disadvantage. But, there are third party tools which overcome this problem like TestNG, Junit, Extent Library, Allure.
WebDriver talks to a browser through a driver. Communication is two way: WebDriver passes commands to the browser through the driver, and receives information back via the same route. The driver is specific to the browser, such as ChromeDriver for Google’s Chrome/Chromium, GeckoDriver for Mozilla’s Firefox, etc. The driver runs on the same system as the browser.