Wednesday 23 January 2013

Lesson 6 - Test Object Model

It is a collection of objects that are used to represent objects in application.Basically,object means any data in application that supports methods and properties. QTP support two types of  objects as,

Test Object(TO) :- QTP creates an object during recording mode that correspond to object in application called as Test Object.The properties of objects are stored in in Object Repository that are used to identify object during run session.

Run Time Object(RO) :- The object that QTP uses to identify actual object in application during run session is Run Time Object. QTP uses the properties stored in object repository to identify actual object in application during run session.
You can add objects in object repository simply by recording events in application or by manually in object repository.

Both TO and RO supports various properties and methods.These properties can be retrieved using GetRO property and can be set using SetTO property.
Use Object Spy to view properties and methods supported by objects.

Object Hierarchy in QTP:-
It is very important to understand how QTP maintains object hierarchy. It will simplify your expert view also and helpful when we use Descriptive Programming.

If object is on simple page then Hierarchy will be as shown:-


In the expert view,you can view your statement as:-

Browser(" ").Page(" ").WebList(" ").Select" "

If object is on simple page having frame then Hierarchy will be as shown:-




In the expert view,you can view your statement as:-

Browser(" ").Page(" ").Frame("MainFrame").WebElement(" ").click

If object is on Window then Hierarchy will be as shown:-














In the expert view,you can view your statement as:-

Browser(" ").Window(" ").Page(" ").Frame("ebRealModal").WebElement(" ").click


If object is on Window which is on other window then Hierarchy will be as shown:-

In the expert view,you can view your statement as:-

Browser(" ").Window(" ").Window(" ").Page(" ").Frame("ebRealModal").WebElement(").click

Important Points:-

  • As you can see in the hierarchy ,there are some nested WebTables which are not recorded in statements.While Creating your script  you don't have to  deal  with them as you can see in expert view.Bottom line is you can ignore them while viewing objects hierarchy.
  • Whenever you record your script for Web application the first Web object is Browser then followed by others as in above cases.
  • Frames are of two type viz, Main Frame and ebRealModal Frame.If the object is on window then its frame will always be ebRealModal frame.

Lesson 5 - Test Result Analysis


When Quick Test finishes running the test, the Test Results window opens. 
Initially, the Test Results window contains two panes for displaying the key elements of your test run.
  1. Test Results Tree :-The left pane displays the Test Results Tree, an icon-based view of the steps that were performed while the test was running. Similar to the test tree in QuickTest main screen, it is organized according to the Web pages visited during the test run and can be expanded (+) to view each step. The steps performed during the test run are represented by icons in the tree. You can instruct QuickTest to run a test or action more than once using different sets of data in each run. Each test run is called an iteration and each iteration is numbered. (The test you ran had only one iteration.)
  2. The right pane displays the three areas as
  •  Test results details.
  •  The iteration summary table indicates which iterations passed and which failed.
  •  The status summary table indicates the number of checkpoints or reports that passed, failed, and  raised warnings during the test.
     


Viewing Result of Specific Step:-

  • In the test results tree, expand (+) Test Recording Summary > Select step
  • The Test Results window now contains three panes, displaying:
  • The Test Results Tree, with one step highlighted
  • The Test Results Details of the highlighted step
  • The Active Screen, showing a screen capture of the Web page on which the step was performed.
  • When you click a page in the test results tree, QuickTest displays the corresponding page in the application view. When you click a step (an operation performed on an object) in the test results tree, the corresponding object is highlighted in the application view.
  • Close the Test Results window.Choose File > Exit.  
Test Result Symbols




Lesson 4 - Recording Script

Before you start recording make test setting.
  • Choose Test > Automation > Record and Run Setting, The Record and Run Settings dialog box opens.
  • In the Web tab, select Open the following browser when a record or run session begins.
  • Choose a browser from the Type list and confirm that the URL in the Address box  for example . http://newtours.mercuryinteractive.com.
  • Confirm that Close the browser when the test is closed is selected.
  • In the Windows Applications tab, confirm that Record and run on these applications is selected, and that there are no applications listed.
  • This setting prevents you from inadvertently recording operations performed on various Windows applications (such as e-mail) during a recording session.
  • Click OK.
  • Click on Record button and your browser opens to the URL you specified.
  • Follow the actions specified in your test case and Record the script.
  • Once you finish recording ,click on stop button to stop recording.
  • Now Run your recorded script using Run Button and make necessary enhancements. 
Types Of Recording In QTP

Standard / Normal Recording:- Records the test in terms of GUI objects.In this mode QTP also captures unnecessary objects in script which are stored in object repository.It is the default mode of recording.

Analog Recording:-Exact keyboard and mouse operations are recorded  in accordance with the application or screen.

Low Level Recording:-It records at the object level and records all run-time objects as Window or WinObject test objects.Use it when QTP is not able to recognize object or environment.It is also useful for capturing objects which are location based.

You can use all recordings in single test based on the areas that you are covering in application.

Tuesday 22 January 2013

Lesson 3 - Getting Started With QTP

Before you start creating your script, understand  QTP window and its Menu.
  • Test Pane:- The area provided by QTP to create, modify  and enhance your script.It supports modes or view.
  • Modes:- QTP has two modes that allows you create your script.
  1. Keyword View:-The keyword view displays your script in the form of keywords (objects represented by icons) arranged in tree like format.Keyword view has components as Item, Operation,  value and Documentation with which testers with no programming skills can deal. 
  2. Expert View:-Expert view displays your script in the form of VB script code and provides substantial capabilities that are not available in keyword view.
  • Active Screen:-QTP provided a feature called Active Screen that holds the snapshot of each and every statement in your script.Viewing the snapshots in result summary makes easy to enhance and debug script.
  • Data Table:-It is a third party excel sheet integrated into QTP. There are two types of data tables available in QTP.
  1. Design Time Data Table
  2. Run Time Data Table
Debug Viewer Pane:- This pane allows you to set or reset values of variables and expression in your script during test execution.

Toolbar Pane:- This area provides various tools of QTP like file, view, resources etc.to operate QTP.
Add In Manager in QTP:- Add In provides the integrated system environment that makes the QTP compatible with the application.By default thee add ins are loaded in QTP , you have to select them at the time of installing QTP.
  1. Activex
  2. Visual Basic
  3. Web
Other than these add in's you have to pay .

QuickTest Professional Environment Support

Windows Applications
(MFC)
• Visual Basic
• Java
• ActiveX
Enterprise Applications
• SAP
• Oracle
• PeopleSoft
• Siebel
Web Technologies
HTML
• DHTML
• JavaScript
Browsers
IE and Firefox
• Netscape
• AOL
Emerging Technologies
• .Net Winforms,
Webforms, Web services
• J2EE Web services
• XML, WSDL, UDDI
Terminal Emulators
• 3270
• 5250
• VT100
Server Technologies
• Oracle
• Microsoft
• IBM
• BEA
• ODBC
• COM/COM+
Multimedia
• RealAudio/RealVideo
• Windows Media Player
• Flash

Languages
• European
• Japanese
• Chinese (traditional and
simplified)
• Korean

Lesson 1 - QTP Testing Worlkflow

Planning :-It is the first phase in QTP testing process.Before you start recording make sure that application area you are going to test synchronizes and communicate well with QTP. Analyse the test case and plan accordingly .Planning includes What resources, Utilities, Reusable actions etc will be required in script.

Recording Basic Test Script :- Following the test case, record a basic test script against  the actions specified in test case.

Enhancing Test Script :- Once a basic test script is created, enhance it.It includes making script readable by renaming objects in object repository, adding additional properties like class, html id etc.,using programming statements to achieve complex testing goals, inserting checkpoints, using regular expressions to validate data, parametrization, adding synchronisation points etc.

Running Test Script :- Once a test script is created run it to verify that all scenarios are covered as mentioned in test case.

Debugging Test Script :- Once you run your script you may get errors, to rectify them debug your script.
You can use Breakpoints, Debuggviewer pane, and Step Commands.

Executing Test Script :- Now, execute your test script in full fetch making sure that it will not generate any errors and it is available for batch run.

Analysis of Test Result And Reporting Defects  :-Analyse test result for any defect or issue in application and remove warnings in test script mentioned in results summary

Lesson 2 - Introduction and Installation of QTP

QTP is an Automated testing tool developed by Mercury interactive later on took over by HP.It uses VB script as its default scripting language .QTP is record and playback tool i.e. it record the events that we perform on application and replay them back.QTP identifies each element of application as an object and provides various methods to work on them.It performs functional and regression testing  through a user interface such as a native GUI or web interface. It works by identifying the objects in the application user interface or a web page and performing desired operations (such as mouse clicks or keyboard events); it can also capture object properties like name or handler ID. Although QTP is usually used for "UI Based" Automation, it also can automate some "Non-UI" based Test Cases such as file system operations, database testing or Web services testing.

Version History of QTP
  1. 1998 - Astra QT
  2. 2000 - QTP 5.0
  3. 2001 - QTP 5.5
  4. 2002 - QTP 6.0
  5. 2003 - QTP 6.5
  6. 2004 - QTP 8.0
  7. 2005 - QTP 8.2
  8. 2006 - QTP 9.0
  9. 2007 - QTP 9.1
  10. 2008 - QTP 9.2
  11. 2008 - QTP 9.5
  12. 2009 - QTP 10.0
Now, the latest version of QTP is 11.0

QTP Installation Guide:-

If you are installing Demo Version of QTPthen i will  recommended you to use virtual drive of XP on your machine. The reason behind this scene is that if you installed QTP on your machine with Demo Version license and if that Demo version expires then you cannot Re-install Demo Version of QTP until and unless you format your machine. So why to get into trouble just follow simple steps. If you are using any software in demo version then you have to uninstall it before its validity ends. Same scene with QTP ,if your Demo License version of QTP 9.1 is for 14 days then you have to uninstall it on 13th day otherwise on 15th day you will have to face troubles for Re-installing it.
So here is the step by step guide to install QTP on your machine with Demo version license.

  1.  Install VMware player on your pc. If you don’t have the set up, download it from here, https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0 
  2. Now Create virtual Drive of XP on your machine using VMware player. 
  3.  Start > VMware player > Create a New Virtual Machine > Select Installer disc > Follow    the instructions.
  4. Open your virtual machine using VMware player.
  5. Copy QTP folder to virtual machine in ‘ C ’ drive and install it.
  6. Select License option as Demo License and Click Next. All options are set by Default so just go on clicking Next till the set up finishes.
  7. Once the set up finishes Restart your virtual machine and open QTP from start menu .
           
Select Add ins that your application  require and Open New Blank test. 

On 13th day uninstall QTP and before reinstalling it clear all registry of QTP using QTP cleaner (a tool that clears all registry of QTP) or if you dont have the tools follow the below process.

QTP Re-Installation Guide
1. Uninstall QTP from control panel 
2. Restart the machine. 
3. From Registry - delete all reference of QTP and Mercury
    (Perform search for the entire regedit and delete)
open Run command and enter regedit 
4. Delete the keys from the HKEY_local_machine\Software
                                        CLSYSTEM                    
5. Delete Rainbow.SentinelLM from HKEY_CLASSES_ROOT 
6. Delete the following files from your system 
wlrun.ini,
mercury.ini,
sysprs7.dll,
clauth1.dll,
clauth2.dll,
lsprst7.dll,
lsprst7.tgz,
lservrc,
ssprs.dll,
ssprs.tgz,
tmpPrst.tgz,
sysprs7.tgz
 
(Some of the files might not be available in your system. Leave it and continue to next step)
 
7. Navigate to <install dir> and delete the folder. 
8. Restart the machine.
9. Re- Install QTP.

Note: If your QTP trial license is not expired than the trial period will get restored to complete 14 days. If you make the QTP license to expire by changing the system date than your QTP license will remain expired even after following the above steps.

Monday 21 January 2013

QTP Vs SELENIUM


QTP: -
Functional Testing Tool -QTP has the feature for storing screenshot of each and every page navigated during the execution. So it can be used as a proof for completion of testing, and also we can refer the screenshots of previous executions if there is any need to refer them. Test report can be automatically written to a customized report page which will ensure accuracy of the report and also it can improve look & feel of the report

Advantages of Using QTP

§User friendliness and less effort for script creation.
§Meets the needs of both technical and non-technical users.
§Advanced solution for functional test and regression test automation.
§Automation scripts are executed within specific interval of time using task scheduler/crone job.
§Many inbuilt functionalities by default and easy configuration.
§Excellent Object Identification process/mechanism.
§Easily integrated with test management tools like QC.

Disadvantages of QTP
In recent economic crisis, software companies are planning for cost reduction and efficient productivity. QTP is losing its market because of the following limitations:

§Runs only in Windows environments.
§Cannot test with all browser types and versions.
§Limited to smaller organizations/ testing teams.
§High licensing and add-inns costs.
§Slow in execution when compared with open source tools.

Selenium: -There are four variants of Selenium, which can be used in isolation or in combination to create complete automation suite for your web applications.

§Selenium IDE – Recording/Creating and enhancing scripts
§Selenium Remote Control (RC)– Executing scripts
§Selenium Web Driver (API) – Cross browser testing
§Selenium Grid – Cross platform testing

Advantages of Using Selenium:-

§Simple and powerful document object model (DOM) level testing, can be used for continuous integration with agile projects.
§Has great extensibility and flexibility, along with its tight integration with the browser unmatched by   available proprietary tools.
§Supports multiple browsers such as Internet Explorer, Fire fox, Safari or Opera on  Windows, Mac OS X and Linux.
§Wires Object Oriented Programming languages like JAVA, .NET, Ruby, Perl, PHP, etc.
§Provides the option of using wide range of IDEs such as Eclipse, Netbeans, Visual Studio etc depending on  the choice of development language.

Disadvantages of Selenium: -

§Supports only browser based application, not the windows application
§Does not support file uploads from local machine
§Provides only partial support for dialog boxes
§Being an open source, Selenium has no official technical support 

Comparison between Selenium and QTP is as follows:-


                FEATURES

              SELENIUM

                QTP

Cost

Open source & Portable

Licensed and very expensive; Ten user license costs approx. 60L

Application support

Web Applications only

Client server applications only (like built in TCL/TK and PowerBuilder)

Support for web browsers

Supports IE, Firefox, Safari and Opera

Supports IE & Firefox only

Object Oriented Language support & Scalability

Supports Java, .Net, Perl, PHP, Python, and Ruby

Supports VB script only

Support for operating system/platforms

Supports Windows PC/MAC/UNIX Platforms

Supports Windows Platform only

Support for Test management tool integration

Not available. Need to track separately

TD/QC will be easily integrated

Test Development Environment

We can use wide range of IDEs like Eclipse, Netbeans, Visual Studio etc

Need Separate environment

UI object management & Storage

Managed using UI-Element user extension and properties A set of dynamically loaded libraries that is stored in the Java archive file.

Built-in object repository and easy handling

Support for Dialog Boxes

Supports partially

Supports all kinds of dialog boxes

Support for File upload (system)

Not available

Supports all kinds of File upload


Conclusion:-
· Using Selenium as the Functional Test Automation Tool, you can reduce the cost incurred for licensing using QTP.
· The efforts involved in scripting for Selenium increased by about 15 % than QTP in the initial stages. Once all the solutions are in place the efforts of automation using Selenium and QTP were almost the same.