Tuesday, October 28, 2014

What is Selenium Tool Suite?


Selenium automation is path-breaking achievement in terms of the features that it has and the tasks that it performs. There were many tools in the market before and after it but Selenium soon led the market in terms of the usage. And this is so because it's easy to learn, simple to use, free to download and effective in implementation. You can read more about selenium from my last article.

This article describes the tools those combinedly forms the Selenium Tool Suite; namely Selenium IDE, Selenium RC(Remote Control), Selenium Webdriver and Selenium Grid. These tools constitute as what we call Selenium Automation tool. Each tool has its purpose and should only be used based on that. So, how do you know which tool is best for you?

1. Selenium IDE


    Selenium Integrated Development Environment(IDE) is the Firefox plugin used to create test scripts. It can do a simple record-and-playback of the user interactions with the browser and then exports them as a reusable script in one of many programming languages that can be later executed. Due to its easy-to-use interface, it can be grasped very fast.

    It is a prototyping tool and has no support for iteration and conditional operations. Hence, it is advisable to use Selenium 2 or Selenium 1 for serious and robust test automation.

2. Selenium Remote Control(RC) or Selenium 1


    Selenium RC was the main selenium project for a long time before it was merged with Webdriver project to form Selenium 2. It support several languages (Java, Javascript, Ruby, PHP, Python, Perl and C#) and almost every browser. Selenium RC has two components:

  • The Selenium Server which launches and kills browsers, interprets and runs the Selenese commands passed from the test program, and acts as an HTTP proxy, intercepting and verifying HTTP messages passed between the browser and the AUT.
  • Client libraries which provide the interface between each programming language and the Selenium RC Server.

    It was successful in overcoming the Same Origin policy, through proxy injection. Previously, Selenium Core was unable to open the pages of the different domains.

3. Selenium Webdriver or Selenium 2


    Selenium Webdriver was developed to overcome the limitations of Selenium RC and is more advanced than Selenium IDE. It better supports dynamic web pages where elements of a page change without the page itself being reloaded. It has well-designed object-oriented API to interact with browsers. It supports all the languages and browsers supported by Selenium 1. Selenium 2 still runs Selenium 1’s Selenium RC interface for backwards compatibility.

    Webdriver does not rely on injected Javascript functions for automation unlike Selenium RC, instead it makes direct calls to the browser using each browser’s native support for automation.

4. Selenium Grid


    Selenium Grid is a tool that allows user to run the tests in parallel across multiple environments, thereby distributing the large test suite over different machines and different browsers. It runs the test simultaneously at the same time using different machine and hence saving the time and boosts the performance.


How to Choose the Right Selenium Tool:

Selenium IDE:
  • Learn the basics of Selenium and get familiar with the selenium commands.
  • Understand about locators and how to use them.
  • Create tests with little or no prior knowledge of automation.
  • Create quick bug reproduction scripts.
  • Save the test suite to various format and can also export to Selenium RC/Webdriver.  

Selenium RC:
  • Design the tests using more elaborate languages than Selenese.
  • Understand the primitive structure of selenium tool.

Selenium Webdriver:
  • Should be always given priority over Selenium RC excluding when the latter is only needed.
  • Create robust and browser-based regression automation.
  • Test dynamic webpages where elements changes constantly.
  • Create customized test results.

Selenium Grid:
  • Run test scripts across multiple browsers and operating systems simultaneously.
  • Run a large test suite by distributing it across and save time.

Reference: Selenium Tool Suite.

Tuesday, October 14, 2014

Selenium Automates Browsers


What is Selenium? The title says it all, Selenium automates browsers. It is though not just limited to automating the browser. In other words, Selenium is actually a suite of tools to automate web browsers across many platforms. It is a power packed tool for automation of your Application under Test(AUT) with its rich features that are hard to find in one tool.

Selenium was originally developed by Jason Huggins in 2004 at ThoughtWorks. He must have been a smart bored-to-the-core guy who preferred automating the tasks to avoid redundant manual effort. He created a sort of JavaScript library that formed that basis of Selenium Core. Selenium Core can be understood as the combination of Selenium RC and Selenium IDE. Finally in 2009, Selenium RC(Selenium 1.0) and Web driver, which was a separate project then, was merged and formed Selenium 2.0. Meanwhile in 2008, another tool Selenium Grid was developed.

Selenium Circle of Life 

This is the logo-ical representation of Selenium tool, which covers the platforms, browsers and programming languages supported by Selenium.

Features of Selenium:


1. Open Source Tool

    To say the least, Selenium is an Open source tool supported by vast community behind it. That means if some feature is not yet supported by selenium, there are people making it possible and soon selenium may support that feature. It can be downloaded free from the selenium downloads.

2. Multiple Browser and Operating Systems

    As shown in the image above, Selenium supports a wide variety of browsers and operating systems. Its support Windows, Mac and Linux platform on one hand and all major browsers like Chrome, Firefox, IE, Safari and Opera on the other. It also supports mobile platforms of Android, iOS, Blackberry and Windows phone, the drivers of which can be downloaded from the download section. More details about supported platforms.

3. Multiple Languages for Scripting

    Selenium supports multiple languages to write your selenium test cases. Eg. Java, Ruby, C#, JavaScript, Python, Php, Perl, Objective C, Haskell, R, Dart and Tcl.

4. Record and Playback

    It support recording the user interaction with browser and playing it back to user. This feature is only available through Selenium IDE which is a Firefox-only plugin.

5. Highly Flexible

    Selenium has its elaborate tool suite to cater to the need of the user. Each tool has its own area of functioning and should be used accordingly. Recorded tests through Selenium IDE can be converted to multiple programming languages and testing frameworks it supports. Selenium Grid distributes the tests over various nodes of different platforms.

6. Active Forum/Support Available

    This is the life support system of the Selenium. Any issues or bug can be reported to the forums in which active selenium users can respond and solve the queries.

Limitations:

1. Supports only the web-based application and cannot automate client-based, windows-based or desktop applications.
2. Do not support applications that use flash/flex or silverlight.
3. No inbuilt reporting capabilities but you can use JUnit, TestNG or NUnit for reporting purposes.
4. No object spy or object repository as in QTP.

Thursday, October 9, 2014

Ruby Installation


Ruby is a cross platform, interpreted and object-oriented language. You need to install Ruby, on any platform on which you wish, to be able to develop or run the existing Ruby programs. It can be easily installed on Windows, Mac OS and Linux/Unix.

Installing the Ruby is very simple and I would guide you through installation on Windows as a platform by using the Ruby Installer for Windows. It gives you everything you need to set up a full Ruby development environment on Windows. If you are having Mac or Linux platform or if you are interested to know about other ways to download the Ruby on your machine, I would suggest a read on Ruby Installation on its official site: Installation Link.

1. Download and Install:


     Download the latest version of Ruby 2.1.3 or you may also download the currently most stable Ruby 1.9.3. Once it is downloaded, double-click the installer to start the installation. Select language and agree to the terms; and then check the boxes as shown in the figure:


Select the check box to set the System Environment Variable Path to the bin folder of Ruby and associate .rb and .rbw files.
Click Install.

2. Ruby on Start Menu:


     Ruby is installed on your machine and can be seen in the Start Menu. It has different entries: Interactive Ruby, which is IRB in a standard command line window; RubyGems Documentation Server, which starts the web server and run the gem command to install the gems on your server; Start Command Prompt with Ruby, which start ruby in command prompt if environment variable is not set for ruby yet; and Documentation, which contains the Ruby API documentation.

3. Install an Editor:


     Install any editor to write the Ruby programs as Ruby installer does not come with an editor or IDE. You can write in Notepad, but it is boring and dull to write in there. So, editor that can be considered includes Notepad++, Programmers' notepad, Sublime text or Scite among others.

This is what all needs to be done to install Ruby. You can start learning Ruby from tutorials online and create your own programs.