Selenium and QTP


SELENIUM
Automation
Selenium
Selenium is a software testing tool which offers the freedom to choose the desired language for scripts. This frame work is used extensively for web applications and can be used in most of the available web browsers. It is specifically used for the user acceptance test and provides intelligent field selection mechanism. Quick Test Professional (QTP) is a GUI automated testing tool which is used for the automation of user actions on a web-based application. The differences between QTP and Selenium can be outlined as below:
  • Selenium offers true level multiple browser support whereas QTP supports Firefox and IE only. If we take the case of programming languages supported by these tools, Selenium out hits QTP as it supports dot net, Java and many other languages compared to the QTP that supports VB script only.
  • All kinds of IE dialog boxes are supported by QTP, but Selenium offers partial support only. You cannot retrieve the title of a dialog box using Selenium.
  • Recognition of objects in Selenium is based on the DOM structure of the HTML page. You can find only vague descriptions for the UI objects in Selenium. But QTP provides user-friendly names to the objects by recognizing and naming the objects based on more obvious and visible properties.
  • Selenium can be used with Windows, UNIX or Mac as it supports Java and hence offers a wide opportunity to test your web-based applications in a variety of platforms. But QTP is restricted to be used in Windows only.
  • You can use different IDEs when working with Selenium, but In QTP only the QTP test development is possible.
  • Selenium is an open source tool and hence lacks an official technical support whereas QTP provides a great technical support and have an active user community.
  • Before considering all the above factors, it is vital to note that QTP is not a free tool and hence most of the people prefer free available Selenium.

QuickTest Professional, popularly known by its acronym QTP is an automation testing tool originally from Mercury Interactive which was acquired by Hewlett Packard (HP) in 2006. QTP is primarily used for functional and regression automated testing. Using QTP, you can automate user actions on a web or client based computer application and test the same actions for different users, different data set, on various Windows operating systems and/or different browsers. Automation using QTP if planned and executed in a proper manner can save considerable time and money.
QTP is one of the most widely used automation testing tools in the market today with over 60% market share. Due to this reason, skilled QTP professionals are always in demand.

Introducing Selenium

Selenium is a set of different software tools each with a different approach to supporting test automation. Most Selenium QA Engineers focus on the one or two tools that most meet the needs of their project, however learning all the tools will give you many different options for approaching different test automation problems. The entire suite of tools results in a rich set of testing functions specifically geared to the needs of testing of web applications of all types. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior. One of Selenium’s key features is the support for executing one’s tests on multiple browser platforms.


Brief History of The Selenium Project

Selenium first came to life in 2004 when Jason Huggins was testing an internal application at ThoughtWorks. Being a smart guy, he realized there were better uses of his time than manually stepping through the same tests with every change he made. He developed a Javascript library that could drive interactions with the page, allowing him to automatically rerun tests against multiple browsers. That library eventually became Selenium Core, which underlies all the functionality of Selenium Remote Control (RC) and Selenium IDE. Selenium RC was ground-breaking because no other product allowed you to control a browser from a language of your choice.
While Selenium was a tremendous tool, it wasn’t without its drawbacks. Because of its Javascript based automation engine and the security limitations browsers apply to Javascript, different things became impossible to do. To make things “worst”, webapps became more and more powerful over time, using all sorts of special features new browsers provide and making this restrictions more and more painful.
In 2006 a plucky engineer at Google named Simon Stewart started work on a project he called WebDriver. Google had long been a heavy user of Selenium, but testers had to work around the limitations of the product. Simon wanted a testing tool that spoke directly to the browser using the ‘native’ method for the browser and operating system, thus avoiding the restrictions of a sandboxed Javascript environment. The WebDriver project began with the aim to solve the Selenium’ pain-points.
Jump to 2008. The Beijing Olympics mark China’s arrival as a global power, massive mortgage default in the United States triggers the worst international recession since the Great Depression, The Dark Knight is viewed by every human (twice), still reeling from the untimely loss of Heath Ledger. But the most important story of that year was the merging of Selenium and WebDriver. Selenium had massive community and commercial support, but WebDriver was clearly the tool of the future. The joining of the two tools provided a common set of features for all users and brought some of the brightest minds in test automation under one roof. Perhaps the best explanation for why WebDriver and Selenium are merging was detailed by Simon Stewart, the creator of WebDriver, in a joint email to the WebDriver and Selenium community on August 6, 2009.
“Why are the projects merging? Partly because webdriver addresses some shortcomings in selenium (by being able to bypass the JS sandbox, for example. And we’ve got a gorgeous API), partly because selenium addresses some shortcomings in webdriver (such as supporting a broader range of browsers) and partly because the main selenium contributors and I felt that it was the best way to offer users the best possible framework.”

Selenium’s Tool Suite

Selenium is composed of multiple software tools. Each has a specific role.

Selenium 2 (aka. Selenium Webdriver)

Selenium 2 is the future direction of the project and the newest addition to the Selenium toolkit. This brand new automation tool provides all sorts of awesome features, including a more cohesive and object oriented API as well as an answer to the limitations of the old implementation.
As you can read in Brief History of The Selenium Project, both the Selenium and WebDriver developers agreed that both tools have advantages and that merging the two projects would make a much more robust automation tool.
Selenium 2.0 is the product of that effort. It supports the WebDriver API and underlying technology, along with the Selenium 1 technology underneath the WebDriver API for maximum flexibility in porting your tests. In addition, Selenium 2 still runs Selenium 1’s Selenium RC interface for backwards compatibility.

Selenium 1 (aka. Selenium RC or Remote Control)

As you can read in Brief History of The Selenium Project, Selenium RC was the main Selenium project for a long time, before the WebDriver/Selenium merge brought up Selenium 2, the newest and more powerful tool.
Selenium 1 is still actively supported (mostly in maintenance mode) and provides some features that may not be available in Selenium 2 for a while, including support for several languages (Java, Javascript, Ruby, PHP, Python, Perl and C#) and support for almost every browser out there.

Selenium IDE

Selenium IDE (Integrated Development Environment) is a prototyping tool for building test scripts. It is a Firefox plugin and provides an easy-to-use interface for developing automated tests. Selenium IDE has a recording feature, which records user actions as they are performed and then exports them as a reusable script in one of many programming languages that can be later executed.

Note

Even though Selenium IDE has a “Save” feature that allows users to keep the tests in a table-based format for later import and execution, it is not designed to run your test passes nor is it designed to build all the automated tests you will need. Specifically, Selenium IDE doesn’t provide iteration or conditional statements for test scripts. At the time of writing there is no plan to add such thing. The reasons are partly technical and partly based on the Selenium developers encouraging best practices in test automation which always requires some amount of programming. Selenium IDE is simply intended as a rapid prototyping tool. The Selenium developers recommend for serious, robust test automation either Selenium 2 or Selenium 1 to be used with one of the many supported programming languages.

Selenium-Grid

Selenium-Grid allows the Selenium RC solution to scale for large test suites and for test suites that must be run in multiple environments. Selenium Grid allows you to run your tests in parallel, that is, different tests can be run at the same time on different remote machines. This has two advantages. First, if you have a large test suite, or a slow-running test suite, you can boost its performance substantially by using Selenium Grid to divide your test suite to run different tests at the same time using those different machines. Also, if you must run your test suite on multiple environments you can have different remote machines supporting and running your tests in them at the same time. In each case Selenium Grid greatly improves the time it takes to run your suite by making use of parallel processing.

Choosing Your Selenium Tool

Many people get started with Selenium IDE. If you are not already experienced with a programming or scripting language you can use Selenium IDE to get familiar with Selenium commands. Using the IDE you can create simple tests quickly, sometimes within seconds.
We don’t, however, recommend you do all your test automation using Selenium IDE. To effectively use Selenium you will need to build and run your tests using either Selenium 2 or Selenium 1 in conjunction with one of the supported programming languages. Which one you choose depends on you.
At the time of writing the Selenium developers are planning on the Selenium-WebDriver API being the future direction for Selenium. Selenium 1 is provided for backwards compatibility. Still, both have strengths and weaknesses which are discussed in the corresponding chapters of this document.
We recommend those who are completely new to Selenium to read through these sections. However, for those who are adopting Selenium for the first time, and therefore building a new test suite from scratch, you will probably want to go with Selenium 2 since this is the portion of Selenium that will continue to be supported in the future.

Supported Browsers and Platforms

In Selenium 2.0, the supported browsers vary depending on whether you are using Selenium-WebDriver or Selenium-RC.

Selenium-WebDriver

Selenium-WebDriver supports the following browsers along with the operating systems these browsers are compatible with.
  • Google Chrome 12.0.712.0+
  • Internet Explorer 6, 7, 8, 9 - 32 and 64-bit where applicable
  • Firefox 3.0, 3.5, 3.6, 4.0, 5.0, 6, 7
  • Opera 11.5+
  • HtmlUnit 2.9
  • Android – 2.3+ for phones and tablets (devices & emulators)
  • iOS 3+ for phones (devices & emulators) and 3.2+ for tablets (devices & emulators)
Note: At the time of writing there is an emulator bug with Android 2.3 that prevents the driver from working properly on device emulators. However, it works fine on tablet emulators and real devices.

Selenium 1.0 and Selenium-RC.

This is the old, support platfom for Selenium 1.0. It should still apply to the Selenium 2.0 release of Selenium-RC.
BrowserSelenium IDESelenium 1 (RC)Operating Systems
Firefox 3.xRecord and playback testsStart browser, run testsWindows, Linux, Mac
Firefox 3Record and playback testsStart browser, run testsWindows, Linux, Mac
Firefox 2Record and playback testsStart browser, run testsWindows, Linux, Mac
IE 8Test execution only via Selenium RC*Start browser, run testsWindows
IE 7Test execution only via Selenium RC*Start browser, run testsWindows
IE 6Test execution only via Selenium RC*Start browser, run testsWindows
Safari 4Test execution only via Selenium RCStart browser, run testsWindows, Mac
Safari 3Test execution only via Selenium RCStart browser, run testsWindows, Mac
Safari 2Test execution only via Selenium RCStart browser, run testsWindows, Mac
Opera 10Test execution only via Selenium RCStart browser, run testsWindows, Linux, Mac
Opera 9Test execution only via Selenium RCStart browser, run testsWindows, Linux, Mac
Opera 8Test execution only via Selenium RCStart browser, run testsWindows, Linux, Mac
Google ChromeTest execution only via Selenium RCStart browser, run testsWindows, Linux, Mac
OthersTest execution only via Selenium RCPartial support possible**As applicable

* Tests developed on Firefox via Selenium IDE can be executed on any other supported browser via a simple Selenium RC command line.
** Selenium RC server can start any executable, but depending on browser security settings there may be technical limitations that would limit certain features.

Flexibility and Extensibility

You’ll find that Selenium is highly flexible. There are many ways you can add functionality to both Selenium test scripts and Selenium’s framework to customize your test automation. This is perhaps Selenium’s greatest strength when compared with other automation tools. These customizations are described in various places throughout this document. In addition, since Selenium is Open Source, the sourcecode can always be downloaded and modified.




QTP

Supported Languages

HP QuickTest Professional uses VB Script as its scripting language. This is the only language that is fully supported by QTP’s IDE. VBScripts supports Object Oriented Programming concepts but not polymorphism and inheritance.

Supported Browsers

  • Internet Explorer 6,7,8
  • Firefox 3.0.X, 3.5
  • QTP 11 provides replay support for Google Chrome browser

Supported Operating Systems

Windows XP, Windows Vista and Windows 7. QTP doesn’t support Mac OS or any other operating system.

Supported Technologies


QTP can be used to automate web based and windows based client-server applications. However, it doesn’t support all technologies by default. For an extended support we need to load the corresponding add–in. For instance, if you were to automate an application based on Java technology, you will have to load Java add–in. [QTP Add-Ins are software provided by HP that needs to be installed on a machine where QTP is installed to support a corresponding technology.]

Quick Test Professional comes with 3 add ins by default – ActiveX, Visual Basic and Web. All-in-all QTP supports .Net, Web, VB, Java, Oracle apps, SAP, PeopleSoft, Siebel, Stingray, Terminal Emulators (Unix, Mainframes), Power Builder, Delphi, Visual Age, Web Services, Flex (By Adobe), Shunra VE Desktop Professional for WAN emulation (By Shunra)

License Types

When you install HP Quick Test Professional, it comes with a default 30 days fully functional demo license. After the demo period, we need to purchase one of the licenses so as to continue working with the tool. There are two types of license, Seat and Concurrent License.

Seat License

It’s a license that is specific to the computer on which the tool is installed i.e. if two or more people want to work on the tool then each one of them has to install the seat license on their respective machines.

Concurrent License

This is a network based license that can be used by multiple users at the same time. This license is installed on a remote license server. Hence a particular number of users can work with the tool by connecting to the license server at the same time; the number varies based on the number of concurrent licenses purchased.
There is a sub type of concurrent license called commuter license. It is a concurrent license that works like a seat license for a given time period. The validity period is usually 180 days. Let’s assume we have configured 10 concurrent licenses and one or two members have to travel on a business trip because of which they couldn’t connect to the license server. In such instances, we can ask administrator to configure commuter license. This works like a seat license for a given time period. Thus for this specific time period, the concurrent licenses available offshore will be equal to total concurrent licenses minus commuter licenses.

Cost of QTP

The cost of a QTP license may vary by geography. In US, a seat license starts from $8000 (USD). These licenses are normally sold to organizations and not to individuals.

Certifications Available for QTP

HP has introduced an entry level certification for QTP called HP0-M47.The exam is conducted by Pearson VUE in collaboration with HP. You can take help of LearnQTP’s high quality mock papers to prepare for QTP certification.

Training on QTP

There are many options available for QTP training. HP offers classroom based trainings but the general consensus among QTP professionals is that the fee charged by them is too high and the syllabus covered is too narrow.  LearnQTP has been conducting an affordable online QTP training program called QTP training OnDemand. This program was started back in 2009 and has seen many revisions since then incorporating feedback from trainees and adding content as per the needs. It is one of the most recommended and well liked QTP training programs available today. Since the program is available online, provides real world knowledge, individuals across the world join this training to enhance their skill set. Check complete details about this programhere.

A Raw Example Where QTP can be Used

Let’s consider the scenario where you want to test login for a particular user. To test this scenario manually, you would generally follow these steps -
  1. Open web browser
  2. Enter the URL of the application.
  3. Enter user id & password and then click on “Login” button on login page.
  4. Verify that login is successful
Now consider a case where you have to test this login functionality many a times or you have to test the same functionality for large number of different users say a 1000 or more users. Performing this action manually is time consuming & tiresome activity. Now QTP helps you replicate your actions that you do manually such as opening the application, entering user id and password and hitting the “Login” or “Submit” button and verifying whether or not you have logged in successfully. To achieve this, you can write your code for log in scenario in QTP and run the code any number of times with a single click of a button, of course with same or different test data as required. This is a very raw example, in trained hands QTP can accomplish a lot many tasks. As of August 2012, HP Quick Test Professional 11.0 is the latest version available in the market.

Version history of QTP

Astra Quicktest (First version)

The first version of QTP was named Astra QuickTest and it was released by Mercury Interactive(MI) in May 1998. The starting price for the software was $3995 per copy. Source: 10k Sec filing by MI on March 29th, 2001

Astra QuickTest 3.0

Astra QuickTest 3.0 was released in Feb 2000. The software copy was priced at $2995 and it needed IE4.0 or higher to run. Source: Mike Oliveira

Astra QuickTest 5.0 (Astra QuickTest Professional 5.5)

Astra QuickTest 5.0 was released in Feb 2001. This version was able to test multimedia elements like Real Audio/Video and Macromedia Flash etc. After the addition of various patches, Astra Quicktest 5.0 was renamed Astra QuickTest Professional 5.5. This version was able to test websites to ensure they meet the requirements of Section 508, an amendment to the Rehabilitation Act of 1973

QuickTest Professional 6.5

QuickTest Professional 6.5 was released in Sep 2003 and lost Astra as part of its name. The major new features added in this version were:
  • Support for QuickTest Automation Object Model
  • Recovery Mechanism
  • XML Output Value
  • XML Schema Validation
  • Analog Recording

QuickTest Professional 8.0

QuickTest Professional 8.0 was released in late 2004. The major new features added in this version were:
  • Unicode Support
  • Keyword View
  • Business Process Testing
  • Action/Test Parameters

QuickTest Professional 8.2

QuickTest Professional 8.2 was released in early 2005. The major new features added in this version were:
  • Patches on top of version QTP 8.0
  • Ability for Auto-Documentation
  • Step Generator
  • Enhanced Expert View

QuickTest Professional 9.0

QuickTest Professional 9.0 was released in April 2006. This was the time when Mercury started phasing out another popular product WinRunner since the company had integrated all its capabilities in QTP. The major new features added in this version were:
  • Object Repository Manager
  • Object Repository Merge Tool
  • Multiple Object Repositories per Action or Component
  • XML Object Repository Format
  • Function Library Editor
  • Handling Missing Actions and Resources

QuickTest Professional 9.1/9.2

QuickTest Professional 9.2 was released in Feb 2007. During this time HP completed its acquisition of Mercury interactive(MI) which started in late 2006. The major new features added in this version were:
  • Mercury Screen Recorder
  • Dynamic Management of Object Repositories

QuickTest Professional 9.5

QuickTest Professional 9.5 was released in Jan 2008. The major new features added in this version were:
  • Support for tabbed browsing
  • Bitmap checkpoint tolerance level through UI itself
  • WebAddin Extensibility

QuickTest Professional 10.0

QuickTest Professional 10.0 was released in Jan 2009. With this version QTP started providing 30 days trial instead of 14 days trial offered in the earlier versions.  The major new features introduced in this version were:
  • Centrally Manage and Share Testing Assets, Dependencies, and Versions in Quality Center 10.00
  • Perform Single-User Local System Monitoring While Running Your Tests
  • Improve Portability by Saving Copies of Tests Together with Their Resource Files
  • Call Actions Dynamically During the Test Run
  • Develop Your Own Bitmap Checkpoint Comparison Algorithm
  • Centrally Manage Your Work Items and ToDo Tasks in the To Do Pane
  • Improve Test Results Analysis with New Reporting Functionality
  • Test Standard and Custom Delphi Objects Using the Delphi Add-in and Delphi Add-in Extensibility

QuickTest Professional 11.0

QuickTest Professional 11.0 was released in Sep 2010. This is the latest version available in the market as of August 2012. The major new features introduced in this version were:
  • XPath and CSS based object identification
  • Good Looking and Enhanced Results Viewer
  • Easy Regular Expressions
  • Now identify objects not only in relation to each other but in relation to neighboring objects. Visual Relation Identifier
  • Load Function Libraries at Run Time
  • Test Your GUI and UI-Less Application Functionality in One Test
  • Record Support For FireFox is now available
  • QTP 11 is capable of receiving Java or .NET log framework messages from your application which can then be embedded in the run results
  • Embed/Run Javascript in web pages
  • Improved test data management when integrated with Quality Center
  • QTP 11 now supports Web 2.0 Toolkit Applications out-of-the-box similar to any other add-ins.
Source: Contents from different different sites, links have been provided (for related source)