QA City

Join Hands to Build a Smarter India: Sign in | Join now
   QA City >> Expert Column
Dont Miss Experts

Web based Testing with Selenium

Naveen Saxena
Naveen Saxena
Senior Test Engineer, Centre of Excellence Group, HCL
Naveen Saxena is working as Senior Test Engineer, Centre of Excellence Group at HCL Technologies ... more>>
Selenium [1] is an open source functional automation tool for the web based application. It was developed by the "Thought Work" in 2004. It is remarkable tool for the functional software testing.

There are two versions for the Selenium:
1. Selenium 1.0 :It consists of below tool suite:
  • Selenium IDE
  • Selenium RC Client/ Server
  • Selenium Grid 
2. Selenium2.0 :It consists of below tool suite:
  • Selenium IDE
  • Selenium Server
  • Selenium Grid
WHY SELENIUM

It is rich from the Selenium Tree, Below are the points:

  • Cost effective: It is an open source tool.
  • Language: Supports many languages like Java, Ruby, and Python and C #.
  • Browser: Supports multiple browsers like IE, Mozilla, Opera, Chrome and Safari so can be used for cross browser testing and can be integrated easily to new launched browser.
  • Framework: Supports multiple frame -works like Junit, TestNG, Bromine, Nunit, Rspec which make the automation more robust and can developed own framework.
  • Operating System: Supports multiple operating systems like Windows, Apple, Linux and Android.
  • Time Saving: With the help of selenium grid, Parallel execution of the test cases can be done.
SELENIUM IMPLEMENTATION

Selenium has two versions, Selenium 1.0 and Selenium 2.0.Both the versions have common components.


Fig 3: Selenium Venn diagram

Selenium IDE: Selenium IDE [1] is plugin to Firefox so can be downloaded easily .Selenium ide is used for record and play back functionality, the default script is generated in html and can play back in html format only on Firefox. For starting the Selenium IDE navigate tools option present in menu bar of the Firefox and click on Selenium IDE option. By default ,Selenium IDE is in recording mode  and start  navigating the application on Firefox browser and perform the action ,all the actions are recorded  and can be seen parallel into  Selenium IDE.
There are two tabs present on it, "Table" & "Source" .Under Source Tab HTML format  or code of the recording can be analyzed and under "Table" tab, there are three columns:

  • Command: It shows the action going to perform like Click, enter etc.
  • Target: It is or objects property where the action is going to perform.
  • Value: Any input value is shown here.
After completing the recording, Test case can be exported into different language by navigating option File>>Export Test case AS ,In similar way,  multiple test cases can be recorded and exported as the Test suite.


Fig 4: Selenium IDE

After completing the recording, Test case can be exported into different language by navigating option File>>Export Test case AS ,In similar way ,  multiple test cases can be recorded and exported as the Test suite.

The HTML code can also be converted directly to the different – different language without exporting the test case, click the option Options>>Format and select the language in which want to convert the test case.

In previous version of selenium-ide, conditional statements like while/for and parameterization cannot be done now it can be done by adding selenium ide extension however it is not that much robust so  make the Selenium more effective ,Selenium RC/Client is used.

Selenium RC Server: Selenium RC [1] is jar file which provides the functionality to launch the selenium test scripts on different – different browsers; it gets all command from selenium client and executes the scripts .For running the selenium scripts, Selenium remote control server is run through the command prompt by the command “java –jar selenium sever.jar”.By default the server is run at 4444 port.


Fig 5: Selenium RC Architecture

Selenium Client Server: Selenium client [1] is nothing just the jar files or say language through which enhancement of the scripts is done and sends the request to selenium rc server. For running the scripts, selenium rc is run through the command prompt.

Selenium Grid: Selenium Grid [1] is most important aspect of the selenium. With the help of this, parallel execution can be done on different – different platform with different browser. It saves the time and increases the scope of the testing and provides the quality software product.

Selenium 2.0: Selenium 2.0 [1] is the updated version of Selenium 1.0, it is also known as the Selenium WebDriver. It is completely based on the object oriented API so supposed to be more robust and can support in better way for the web based testing. ,Selenium IDE & Selenium Grid are working in similar way as implemented in selenium 1.0 however  there is no need to run the selenium server for running the scripts. Selenium server is required when have to perform parallel execution through selenium grid or have to connect the remote machine.
WebDriver API [2] makes the direct call to launch the browser using browser’s native call. For every browser, browser’s driver is present. Below is list for the same for Java.

  • Internet Explorer: WebDriver driver = new InternetExplorerDriver();
  • Firefox: FirefoxProfile profile = new FirefoxProfile();
  • Chrome: WebDriver driver = new ChromeDriver();
  • Opera: WebDriver driver = new OperaDriver();

Fig 6: Selenium 2.0

Selenium WebDriver API also supports the Android and IOS operating system. It has separate API to interact with it.

REPORTING

Reporting is very important aspect for testing, In Selenium, there is predefined framework like Junit, TestNG which generates the HTML reports and there are so many API through which customized report is generated. Selenium can integrate with test management tool like QC and Test link so report can be imported from these tools also.

AUTOMATION FRAMEWORK

Automation framework [3] is strategy for the automation, it provides the structured way for the automation for obtaining the quality work with quantity and effectiveness .There are many predefined framework in Selenium like Junit, TestNG, Nunit etc. however implementation of hybrid framework concept with any predefined framework make selenium more effective.
Keyword driven approach for selenium web driver is more effective because there are maximum 30 to 40 keywords which can be converted into the reusable function and can be used for testing any web based application.

CHALLENGES AND WORKAROUND

Selenium is for testing the web based applications so while doing web based testing, many times user has to interact with window component or window popup so selenium cannot automate that however Autoit is third party open source tool which can be used. At the run time, Objects are not identified with default ID or X-path than can use different xpath for the same object or different property like CSS, DOM, and Name etc.

CONCLUSION
  • Selenium is better option for the automation of the web based application.
  • Increase the scope of testing.
  • Provide more confidence to the customer.
  • Regression and Smoke testing time will be condensed.

REFERENCES   

[1.] Selenium HQ : http://seleniumhq.org/

[2].   [2.]Selenium : http://code.google.com/p/selenium/

[3].   [3.]One stop :www.onestoptesting.com


              

[1

 

                                                                                                                              
Experts on QA
Sasank Taraka Kumar
QA Lead
RAM Informatics Ltd
Ramesh  Letchumanan
Testing Engnr
R and D Tech
Nishu  Miglani
CEO
Quest consultants
Satish  Dappin
Sr QA Engineer
Juniper Networks
Mukesh  Jarial
Software Engineer
Interglobe
Sasank Taraka Kumar
QA Lead
RAM Informatics Ltd
Sudhir  Patnaik
Director Engineering
Intuit India
Bobin Motti  Thomas
Sr Tech. Associate
Tech Mahindra
SiliconIndia About Us   |   Contact Us   |   Help   |   Community rules   |   Advertise with us   |   Sitemap   |  
News:       Technology   |   Enterprise   |   Gadgets   |   Startups   |   Finance   |   Business   |   Career   |   Magazine  |   Newsletter   |   News archive  
Cities:        CEO   |     Startup   |   Mobile   |   CIO   |   Women   |   BI   |   HR   |   SME   |   Cloud   |   Marketing   |   QA   |   Java   |   Web Developer  
Community:      Members   |   Blogs   |   Indian Entrepreneurs   |   Gyan   |   Advice   |   Community   |   Find   |   Events   |   CXO Insights  
Job Board:      Jobs   |   Freshers   |   Companies   |   HR Speak   |   Forum  
Online Courses:   Web Developer   |   Java Developer   |   CCNA Training   |   SEO   |   SAS   |   SQL Server 2005   |   J2EE
Education:   MBA   |   MCA   |   Engineering   |   Training Institute
Life:          Real Estate   |   Travel   |   Finance   |   Gadgets   |   Movie Reviews   |    Jokes  
Send your feedback and help us continue to improve SiliconIndia
© 2014 InfoConnect Web Technologies India Pvt Ltd. all rights reserved