What is Selenium?
Basically, Testing is mainly divided into two categories. First is Functional testing and second is Non-functional testing. In functional, we have two kinds of testing: Manual testing and Automation Testing.
In manual testing, our main activity is to write the test cases. These test cases will be executed manually by some resources but when comes to automation testing, all the manual test cases will be converted into the test scripts with the help of some automation tools like Selenium, QTP, RFT, etc.
Thus, the process of converting manual test cases to the test scripts with the help of some automation tool is called automation testing. The main advantage of using these tools are we can save time.
Let’s understand with real-time examples of how automation testing saves time over than manual testing?
Real-time Example 1:
Suppose you have to go from place A to place B which is 1 km apart. There are multiple ways to go from A to B. Manually, you can go by walk but it will take more time. Another way is by using some vehicles like a bike, car, bus, etc. It will save time. Here, the vehicle is nothing but the automation tool.
Real-time Example 2:
Suppose you are working for an IT company and you have to execute around 500 test cases manually then how many test cases can you execute manually? You can execute 50 to 60 test cases manually per day. Here, per day means 8 hours working in the company.
Thus, to execute all these 500 test cases will take time around 9 to 10 days. Now suppose Technical Lead came and says that you will have to execute all these 500 test cases in 4 to 5 days then what will you do?
In this case, you will have to go for automation testing but it is not possible to execute entire testing. Means 100% testing is not possible using automation but the majority of test cases can be executed.
Suppose 400 test cases can be automated and the remaining 100 test cases are not applicable for automation. In this case, we will use manual testing. So, it will take around 2 days manually where 400 test cases will take time 0 days because once test scripts are ready and working fine then we will put all these test cases in run mode at any time (day or night) and leave them to execute all test cases.
When the execution process is completed, we will check results that how many test cases are passed or failed by taking screenshots? That’s why it will take 0 days but take some time to execute all test cases. Thus, we have taken around two days to execute all test cases and have saved time.
There are four components available in selenium suite to automate the web application.
These components are shown in the below figure.
Let us briefly take a look at the components of selenium.
2. It is an easy-to-use Firefox plugin which supports the only Mozilla Firefox. It does not support any other browser like chrome, internet explorer.
3. It is used to create and edit test cases and test suite.
4. Selenium IDE supports record and playback features for generating and executing the test scripts in Firefox browser. Let’s take one real-time example to understand the concept.
Real-time Example 3:
Suppose you have a mobile. In the mobile, you have an option like audio recording features. How will you record your voice for 1 min? For recording, you will put your mobile in the audio recording mode and start to speak something for one minute. When one minute is completed, you will playback it to check the recording.
The same kind of actions occurs in the Selenium IDE. In the Selenium IDE, we record our test cases like logging, send an email, compose, register etc depending on the applications. Once the recording is completed, we can playback to execute them.
If required, we can also execute in other browsers with the help of Selenium RC and WebDriver. By default, it will record in the HTML language only but you can convert the recorded language into other languages also.
Selenium IDE is accountable for user actions. That means whatever the actions you are performing like opening URL, clicking on some button, selection value from the drop-down etc, All these actions are recorded and generated into the scripts.
Initially, it will give you in the HTML language. After recording, It is played-back again and again to reperform those actions. Recording, as well as execution, can be done in the Firefox only.
1. Selenium RC stands for Selenium Remote Control. It is also known as Selenium 1.0. It is open-source automated testing software to test web-based applications. It was designed by Paul Hammant.
3. In 2007-08, the Test Automation Engineer could be able to control and automate the entire application by using Selenium RC. He can perform the actions like clicking on a button, entering text into a TextBox, selecting the value from the drop-down box, etc and test the whole functionality of web application. That’s a reason that the given name with the selenium is remote control.
4. Selenium RC requires a server to be started before the execution of the test script. A server is responsible to serve your request in the selenium RC.
For example, suppose you have a Gmail account. You have entered a user id and password. After entering credential, it will send your request to the server and the server will send your request to the database then the server will take the response from that database and the response will be given back to the application as shown in the below figure.
7. It does not support record and playback feature.
1. Selenium WebDriver is a latest, free, and open-source library to automate the web applications. It is a pure object-oriented tool.
2. In 2008, Selenium RC was merged with another testing framework called WebDriver to develop a more powerful tool called Selenium 2. That’s why it is called Selenium WebDriver.
3. It was developed to support dynamic web pages and advanced web application testing. Selenium 2.0 was released on July 2011.
4. The main aim of selenium web driver is to automate the web applications and make sure that the website is working as expected. It contains a variety of classes and methods to meet our requirement.
5. It supports different programming languages such as Java, Ruby, Perl, PHP, Python, and .Net to create the test scripts.
6. It supports different browsers like Firefox, Chrome, Internet Explorer, Safari, etc.
1. Selenium grid was developed by Dan Fabulich and Nelson Sproul with the help of Patrick Lightbody in 2005 to minimize the test execution times as much as possible.
2. It provides a cross-browser testing environment with several different browsers (such as Firefox, Google Chrome, Internet Explorer etc) and different platform (Window, Mac, and Linux) to execute a test.
3. Selenium grid uses the hub-and-nodes concept. The hub acts as a central point which has the information of all different testing platform, known as nodes. All nodes are connected to a hub that enables simultaneous execution of tests in multiple browsers.
4. It provides parallel execution of tests to save a lot of time. Let’s take an example to understand the selenium grid concept.
Let’s understand it with a practical example.
Suppose we have automated 100 scripts in 2 hours by using WebDriver in Firefox browser. Now my plan is to run all these 100 scripts in different browsers such as internet explorer, Firefox, and chrome. Suppose each browser is taking 2 hours to execute all 100 test scripts. So, all three browsers will take time 6 hours to execute.
If we use selenium grid to automate 100 scripts, we can execute all 100 test scripts in parallel on all three browsers. Thus, the main advantage of using selenium grid is that we can launch all browsers parallelly at the same time and the script can be executed in all browsers at the same time.
Thus, we can save time. We can use total 5 browsers by using the grid.
1. Selendroid is one of the best and most powerful testing tools for Android application. It is an automation testing framework to test multiple types of mobile application like native, hybrid, and web.
2. Since Selendroid uses the Selenium WebDriver framework so we can write the test scripts using the Selenium 2 client APIs.
3. Using the Selendroid, you can also run tests in parallel on multiple devices.
Let us understand it with a practical example.
Suppose we have a Gmail web application and have tested on my system. Now we want to test the same Gmail web application on the android mobile. So this test can be performed by using the Selendroid to test the web application on the android device.
1. Appium is an open-source mobile automation framework which is used to test the native, hybrid, and web mobile application on iOS and Android operating system with the help of Selenium web driver.
2. It replaces the Android driver and iPhone driver APIs in the selenium 2 that were used for testing mobile applications.
4. Using Appium automation framework, we can perform cross-platform mobile application testing.
How to choose the Right Selenium Tool for your need?
You do not need to learn all the above selenium tools but knowing the basics of each component will be helpful and it will boost your confidence in selenium. Generally, we have to work with the most powerful tool WebDriver because WebDriver is the main driving tool to automate user actions on different browsers and different operating system.
Each browser provides their own driver such as Firefox driver, Chrome driver etc to automate actions. If you have enough number of tests to automate and want to run all tests in parallel then you may use Selenium Grid to run your tests on different browsers in parallel.
Selendroid and Appium are used for testing mobile web application. As far as learning is concerned, You can learn WebDriver, selenium grid, Selendroid, and Appium. You do not need to learn selenium 1 in order to learn selenium 2 or 3.
Difference between Selenium & QTP
The difference between selenium and QTP are explained in the below table.
|1. Selenium supports almost all popular browsers such as Firefox, Chrome, IE, Opera, etc.||1. QTP supports only Chrome, Firefox, and Internet Explorer browser.|
|2. Selenium supports operating system like windows, Linux, and Mac.||2. QTP supports only the windows operating system.|
|3. Free open source tool.||3. Licensed tool (Commercial tool)|
|4. It supports only testing of the web-based application.||4. It supports both web and windows based application.|
|5. Object repository needs to be created in the selenium.||5. QTP automatically creates and maintains object repository.|
|6. It supports multiple programming languages like C#, Java, Python, Ruby, perl, etc.||6. It supports only VB script.|
|7. We can execute tests in parallel.||7. In case of QTP, we can execute tests in parallel only using Quality Center which is again paid product.|
Note: QTP stands for Quick Test Professional which is the product of Hewlett-Packard. It uses Visual Basic Scripting (VB Script) for automating web and windows based applications.
Hope that this tutorial has covered almost all the basic important points related to selenium and its components. I hope that you will have understood this topic and enjoyed it.
Thanks for reading!
⏪ PrevNext ⏩