Thursday, March 5, 2020

Selenium

What is Selenium?

Selenium is a free (open-source) automated testing framework used to validate web applications across different browsers and platforms. You can use multiple programming languages like Java, C#, Python etc to create Selenium Test Scripts. Testing done using the Selenium tool is usually referred to as Selenium Testing. It has four components..
Selenium Components

Selenium IDE: Selenium Integrated Development Environment (IDE) is the simplest framework in the Selenium suite and is the easiest one to learn. It is a Firefox plugin that you can install as easily as you can with other plugins. However, because of its simplicity, Selenium IDE should only be used as a prototyping tool. If you want to create more advanced test cases, you will need to use either Selenium RC or Web-driver.

Selenium Remote Control: Selenium RC was the flagship testing framework of the whole Selenium project for a long time. This is the first automated web testing tool that allowed users to use a programming language they prefer. (For Example: Java, C#, PHP, Python, Perl, Ruby)

Pros
Cons
Cross-browser and Cross  platform
Installation is more complicated than IED
Can perform looping and conditional operation
Must have programming knowledge
Can support Data-driven testing
Need Selenium RC server to be running
Has matured and complete API
API contains Redundant and confusing commands
Can readily support new browsers.
Browser interaction is less realistic
Faster Execution than IED
Slower execution than Web-driver

Selenium Web-Driver: The Web-Driver proves itself to be better than both Selenium IDE and Selenium RC in many aspects. It implements a more modern and stable approach in automating the browser's actions. Web-Driver, unlike Selenium RC, does not rely on JavaScript for Automation. It controls the browser by directly communicating with it. The supported languages are the same as those in Selenium RC.(Java, C#, PHP, Python, Ruby)

direct communications


Selenium Grid: Selenium Grid is a tool used together with Selenium RC to run parallel tests across different machines and different browsers all at the same time. Parallel execution means running multiple tests at once.
Features:
  • Enables simultaneous running of tests in multiple browsers and environments.
  • Saves time enormously.
  • Utilizes the hub-and-nodes concept. The hub acts as a central source of Selenium commands to each node connected to it.
How to Choose the Right Selenium Tool for Your Need:

Selenium IDE:

  • To learn about concepts on automated testing and Selenium.
  • Selenese commands such as type, open, click and wait, assert, verify, etc.
  • Locators such as id, name, x-path, CSS selector, etc.
  • Executing customized JavaScript code using run script
  • Exporting test cases in various formats.
  • To create tests with little or no prior knowledge in programming.
  • To create simple test cases and test suites that you can export later to RC or Web-Driver.
  • To test a web application against Firefox and Chrome only.
Selenium RC:
  • To design a test using a more expressive language than Selenese
  • To run your test against different browsers (except Html Unit) on different operating systems.
  • To deploy your tests across multiple environments using Selenium Grid.
  • To test your application against a new browser that supports JavaScript.
  • To test web applications with complex AJAX-based scenarios.
Selenium Web-Driver:
  • To use a certain programming language in designing your test case.
  • To test applications that are rich in AJAX-based functionalities.
  • To execute tests on the Html-Unit browser.
  • To create customized test results.
Selenium Grid:
  • To run your Selenium RC scripts in multiple browsers and operating systems simultaneously.
  • To run a huge test suite, that needs to complete in the soonest time possible.
When to use Selenium Automation?
Selenium can be used to perform repetitive functional and regression testing. Every organization wants to reduce their manual testing cost and thus have started using Selenium. This is an automation testing tool to avoid repeated manual work, receive faster feedback, reduce cost of manual testing and save time on running tests repeatedly, and ensure that tests are executed consistently with the same preconditions and expectations.

Who should use it?

Developers:- For “browser” regression testing (and replace HTML unit/HTTP unit in some cases).
Users (Business Analysts, Functional Tester, and Developer):- Can create automated keyword scripts using MS Excel or the Script Editor after getting familiar with the keyword repository.
Quality Assurance professionals:- Enhance or use it to do regression test/cross browsers testing on all platforms. QA can cover all types of functional testing (like a system, sanity, smoke, integration, etc.) and acceptance testing using Selenium until that has a GUI interface.

Featured Posts