Tuesday 27 August 2013

Learn Selenium – Some useful tips


Learn Selenium – Some useful tips
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 goodUser 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:
1.    I am very much new to Selenium, how I can Record and Playback scripts?
2.    I don’t know how to setup Selenium with Eclipse IDE?
3.    Is there any need to learn Java in order to automate test cases using Selenium?
4.    How to create Data driven framework for Selenium?
5.    How to use JUnit with Selenium?
Basically we need to understand some concepts before starting to use Selenium for automation.
1.    What is test automation?
2.    Why the Test Automation is needed?
3.    How a Functional Test Automation tool works?
4.    Which is the programming language / scripting technique used with the tool?
5.    What is programming skill and how can I improve my debugging skills?
6.    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?
1.    Learn Java starting from “Hello World!!” program. Download Eclipse IDE and learn how to use it.
2.    Understand the data types, looping structures, flow controls (if else, switch case)
3.    Learn OOPS (Object Oriented Programming System)
4.    What is a class, object, and method? What is encapsulation? What is an access modifier?
5.    Inheritance, Polymorphism, Method overloading / overriding, constructors / destructors
6.    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.
What next?
1.    Download and install Selenium IDE
2.    Download some open source web application (Google and find out some open source web application, there are many on the internet)
3.    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)
4.    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)
5.    Once you are comfortable with Selenium IDE and the APIs, then try to export them and save to some notepad.
6.    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.

No comments:

Post a Comment