Selenium is a Test Automation tool for Web Applications. Unlike QTP, TestComplete, or any other market leading commercial automation tools Selenium does not have a good IDE (Integrated Development Environment) for development of automation scripts. Unless having a good knowledge of a programming language such as Java or C#, it is very difficult to understand the way Selenium works although it looks very simple. One more point I want to make it very clear is that Selenium lacks a good User Guide since it is a open source tool. Of course, I agree that Selenium’s documentation is very good and comprehensive. But it is a little difficult for the testing engineers who are newly learning automation concepts and lacking good programming skills.
After listening to many testers who want to learn Selenium, I wanted to provide some guidelines which will help learning Selenium.
Some of the very much popular questions I saw on Selenium forums are:
- I am very much new to Selenium, how I can Record and Playback scripts?
- I don’t know how to setup Selenium with Eclipse IDE?
- Is there any need to learn Java in order to automate test cases using Selenium?
- How to create Data driven framework for Selenium?
- How to use JUnit with Selenium?
Basically we need to understand some concepts before starting to use Selenium for automation.
- What is test automation?
- Why the Test Automation is needed?
- How a Functional Test Automation tool works?
- Which is the programming language / scripting technique used with the tool?
- What is programming skill and how can I improve my debugging skills?
- Does the tool support IDE or should we use some other IDE for development of automated test case?
According to me first and foremost thing which is needed for an automation tester is having good programming skills.
“Practice makes man perfect” – write more and more programs that helps you to improve programming logic and debugging skills.
Before starting to learn Selenium, it is better to learn Java (or C#, Ruby, PHP, Python) and develop good debugging skills. Debugging is nothing but executing the program step-by-step and find out the values of variables used in each step. Thereby find out the root cause of the issues (if any) with the program we have written. This greatly helps a programmer or an automation tester. With Selenium, programming skill is very much important.
How to learn Java (or any programming that Selenium supports) and acquire debugging skills?
- Learn Java starting from “Hello World!!” program. Download Eclipse IDE and learn how to use it.
- Understand the data types, looping structures, flow controls (if else, switch case)
- Learn OOPS (Object Oriented Programming System)
- What is a class, object, and method? What is encapsulation? What is an access modifier?
- Inheritance, Polymorphism, Method overloading / overriding, constructors / destructors
- Learning exception handling is very important. Because whenever Selenium / Java throws any kind of exception we can easily understand why the exception is thrown and the type of exception.
When I mentioned all these concepts, don’t think that it is too much to learn. It is just Core Java. Only thing is we need to write a lot of programs which explain the concepts. Once these concepts are clear, then keep on writing / executing simple-to-complex programs and execute them step-by-step. Watch the variables during the execution to enhance debugging skills.
- Download and install Selenium IDE
- Download some open source web application (Google and find out some open source web application, there are many on the internet)
- We can even utilize some of the web sites online (such as any technology forums) which contain all different types of objects (edit boxes, tables, drop downs, radio buttons, check boxes, etc)
- Record some test scenarios and try to play back step-by-step (click and run each step on the IDE, otherwise there is a chance that you might not be able to execute the entire script because of the application loading time)
- Once you are comfortable with Selenium IDE and the APIs, then try to export them and save to some notepad.
- Go through the code.
All these steps look tedious but it is very easy to follow, it does not even take a week’s time. Once these are done, download Selenium-Java-Client driver and integrate that with Eclipse IDE. Now, you can straight away export all the scripts recorded so far to Eclipse IDE and execute them.
Learn Selenium and enjoy the freedom of Open Source.