When performing cross browser testing manually, one roadblock that you might have hit during the verification phase is testing the functionalities of your web application/web product across different operating systems / devices / browsers are the test coverage with respect to time. With thousands of browsers available in the market, automation testing for validating cross browser compatibility has become a necessity.

Referring to automation and considering our love for open-source softwares, it is inevitable to turn a blind eye from one of the most renowned test automation framework called “Selenium”. We have covered automation testing with Selenium WebDriver for cross browser testing previously on our blog where we discussed different variants of Selenium i.e IDE, RC, WebDriver etc and ran our first automation script.

In that article we emphasized the limitation of working with Local Selenium WebDriver. With ‘Local Selenium WebDriver’, you can perform browser compatibility testing ‘only’ on the browsers that are installed on the machine (where testing is performed) i.e. your testing effort is limited to only a certain combination of (device + operating system + browser).

Verification of your web-application/web product with the ‘local’ version of the Selenium WebDriver is not a scalable approach. Some of the problems that you encounter with this kind of setup are:

  • How to verify functionalities on platforms/operating systems which are not installed on the machine? i.e. even if it is a dual-boot machine, you will still have the problem.
  • How to perform automated cross browser testing on browsers with different versions? e.g. your machine can have Firefox version 64.0, but you want to perform the testing on Firefox version 36.0.
  • How to perform cross browser testing of a website on multiple number of browsers? e.g. your machine may not have Opera installed but for the purpose of testing, you would need to install these browsers (unnecessary disk space consumption).
  • How to attain the best performance i.e. parallelization while performing the tests on local machine?

Though local Selenium WebDriver is ideal for testing on a smaller scale, the necessary amount of ‘scalability’ & ‘performance’ can be achieved after you setup a ‘Selenium Grid’.

This article is a Selenium Grid tutorial where you would realize how web-developers and software testers leverage the power of the Selenium Grid setup to perform automated cross browser testing. I will demonstrate you with an example scenario.

We will be making use of the following languages, frameworks & tools (IDE) to write better automation code.

  • Programming Language – Python (Download Link)
  • Test framework – pytest
  • Web application framework – Selenium
  • Integrated Development Environment – Eclipse version 4.90 (Download Link), PyCharm – Community Edition (Download Link)

What Is Selenium Grid?

Selenium Grid is a testing tool (which is a part of the Selenium Suite) that is based on the ‘client-server’ architecture. In Selenium Grid terminology, Client machine is termed as ‘Hub’ and server(s) are termed as ‘Nodes’.

Selenium Grid setup allows you to execute cross browser testing through a variety of different machines across different browsers (as well as different versions of browsers) & different operating systems. Hence, it brings the require amount of ‘parallelism’ & ‘distribution’ to your test execution environment.

A Selenium Grid setup can have only one Hub and ‘n’ number of nodes. The primary job of the ‘hub machine’ is to distribute the test case supplied to the ‘node machine’ which matches the capabilities/requirements required for executing the test case for performing cross browser testing. We would discuss more Hub & Node (which are the core components for the setup of Selenium Grid infrastructure) in further sections.

There are two versions of Selenium Grid available, namely Selenium Grid 2.0 & Selenium Grid 1.0. Selenium Grid 2.0 is most popular amongst automation testers since it supports Selenium RC (Remote Control) and Selenium WebDriver scripts.

Why Selenium Grid Setup Is A Smart Call To Make?

There are a number of benefits of Selenium Grid setup. Here, we have a look at some of the top advantages of Selenium Grid setup as a part of your test execution strategy for performing cross browser testing.

  • Reduced Execution Time – Selenium Grid setup can be used to execute multiple test cases on different browsers (and browser versions) and operating systems. You can also run multiple instances of Selenium RC along with the test configuring combinations. As the tests are executed in ‘parallel’ (scattered across different machines), the overall time consumed for cross browser testing trims down significantly.
  • Scalable & Maintainable – As we know, Selenium Grid setup reduces the amount of time required for ‘parallel testing’ by a huge margin, the entire solution is highly scalable. If you want to perform testing on a ‘new node’ (which could be Operating System/Browser), all it needs are few minor tweaks in the code with respect to the addition of capabilities, and your solution for the new node is ready.
  • Perform Multi-Combination Testing – Using the Hub & Node feature of Selenium Grid setup, you can perform multi-OS, multi-browser, and multi-device verification of your source code.

#selenium #selenium-grid #test-automation #tutorial #testing #selenium-webdriver #good-company #qa

Getting Started with Selenium Grid Browser Testing
1.45 GEEK