Pages

Wednesday 23 May 2012

Run Selenium Tests on Cloud

Selenium IDE is an Integrated Development Environment for record, playback and debug selenium test scripts. As Selenium IDE is implemented as a Firefox add-on, it only works with Firefox. To run selenium IDE test scripts across multiple environments, we have to go through many configurations which needs many headaches.

To remove all these limitations and headaches, Sauce Labs has introduced Sauce Builder. Here are some important features about Sauce Builder :-

  1. Provides features like record, playback and debugging of selenium tests.
  2. Selenium 1 and 2 compatible.
  3. Run selenium tests in local browser and Sauce onDemand.
  4. Video and screen shots of every selenium tests.

Sauce Builder installation guide :-

Sauce Builder comes as a Firefox extension. Here are some to install it into your system :-

  1. Launch Firefox and navigate to the  Sauce Builder download page .
  2. Download Sauce Builder from this page and install.
  3. Restart Firefox.
  4. Open Sauce Builder by choosing Launch Sauce Builder item from the Tools menu of Firefox or press Ctrl+Alt+B from the keyboard.


For more information on Sauce Builder visit : http://saucelabs.com/docs/builder.

Wednesday 2 May 2012

Implementing Firfox profile in Selenium Webdriver with Java

While automating a web application, we want the application to be opened in a customized browser. A browser without any theme/extension/add-ons or with customized settings; settings like pop-ups are allowed, certain sites are certified etc. The reason why we want a different browser profile is our regular use browser has several add-ons installed, several bookmarks, and some browser level restrictions which might hamper the proper functioning of the AUT. Firefox provides a good mechanism to manage different profiles of browser in the same machine. http://goo.gl/NTklV is a link which shows how to create a profile in Firefox. While creating a profile, we can customized the browser settings per our project need.

This tip is about how to implement a profile in Selenium Webdriver using Java. This implementation is of course after manually creation of the profile. The below code snippet demonstrates the implementation of profile in Webdriver :

ProfilesIni allProfiles = new ProfilesIni(); //Declare an object of ProfilesIni class

FirefoxProfile fProfile = allProfiles.getProfile("Profile Name"); //Get the specific Firefox profile information. "Profile Name" here is the name given to the profile while creating it.

FirefoxDriver wbdv = new FirefoxDriver(fProfile); //Pass the profile information to FirefoxDriver.

When a browser will be opened using “wbdv” object, it’ll be opened with the specified profile.

Tuesday 1 May 2012

Selenium Overview




What is Selenium ?

Selenium is a software testing framework used for testing web applications.
  • It provides support to write test scripts in many popular programming languages, including C#, Perl, Python, Ruby, Java etc.
  • It also provides a great support in running the test scripts across multiple platforms, including Windows, Linux and Macintosh.
Mainly for these two reasons, Selenium is so popular in automation world.


Looking Inside Selenium

Selenium has many components that coalesce well to cook a wonderful automation testing system. Following are the components of Selenium :-
  • Selenium IDE
  • Selenium Remote Control
  • Selenium WebDriver
  • Selenium Grid

Selenium IDE :-  
Selenium IDE was originally created by Shinya Kasatani in 2006 and implemented as a Firefox add-on which helps to record, playback and debug selenium tests. It records tests in its special test scripting language called as Selenese. Following are the features supported by Selenium IDE :-
  1. Record of tests and play them back.
  2. Debug test cases by setting break-points.
  3. Convert test cases to JUnit, Python, Ruby, C# or other formats.
  4. Support for adding user extensions.
  5. Locate web elements using IDs, XPaths etc.


Fig : Selenium IDE


Selenium IDE only works with Firefox. To run Selenium IDE tests across multiple browsers we need one server which will help IDE in doing that. Fortunately, we have one : Selenium Remote Control.


Selenium Remote Control :-
Selenium RC is a server which acts as a proxy between Application Under Test (AUT) and the test scripts.
It interacts with different browsers through the selenium core which is bundled with Selenium RC. It removes the need of installing selenium core on the web servers.



Fig : Selenium RC



Selenium Web Driver :-
Selenium web driver is the successor of the Selenium RC. Selenium Web Driver works in the same way users interacts with the web pages. In contrast to Selenium RC, it doesn't need a server to run. It directly starts a browser instance and controls it.


Selenium Grid :-
Selenium Grid is a server used to distribute tests on multiple machine so as to run tests in parallel. It cuts down the time required for running in-browser test suites.



Fig : Selenium Grid



Download Selenium from :- http://seleniumhq.org/download/


For study materials on Selenium :- 
  1. http://seleniumhq.org/docs/
  2. http://qtpselenium.com/selenium-tutorial/