60761011.

doc

QTP Frame Work

QTP
Frame Work

Confidential

Page 1 of 100

60761011.doc

QTP Frame Work

Table of Contents
1. Automation Architecture.......................................................3 1.1 Design........................................................................................................................3 1.2 Approach for Test Automation..................................................................................4 2. Introduction to QTP........................................................11 2.1 QTP Environment Compatibility.............................................................................12 2.2 Versions of QTP......................................................................................................13 3. Add-Ins...............................................................................21 3.1 Types of Add-Ins.....................................................................................................21 3.2 Conditions for Add-ins............................................................................................22 4. Conventions.........................................................................23 4.1 Test Case Naming Conventions:..............................................................................23 4.2 Script and Action Naming Conventions:................................................................23 4.3 Variables and Constants:..........................................................................................25 4.4 DataSheet Naming and Parameter Naming Conventions:.......................................26 4.5 Function Naming Conventions................................................................................27 5. Settings...............................................................................28 5.1 QTP Test Settings....................................................................................................28 5.2 Record and Run Settings..........................................................................................29 5.3 Active Screen Capture Level...................................................................................29 5.4 Object Repository....................................................................................................30 5.5 Expert View.............................................................................................................32 5.6 Setting related to the Application Used:..................................................................35 6. Objects...............................................................................38 6.1 Objects....................................................................................................................38 7. Data Table..........................................................................40 7.1 Datatable Object and related Functions:.................................................................40 7.2 Organizing Data Sheets for Global & Local variables............................................41 7.3 Parameterizing using Data driven Wizard.............................................................42 7.4 Importing and Exporting Datasheets:...................................................................46 8. Actions................................................................................49 8.1 Actions Settings.......................................................................................................49 8.2 Iterations using rows................................................................................................50 8.3 Action Template.......................................................................................................51 8.4 Script Startup...........................................................................................................51 8.5 Splitting Actions, Re-usable Actions, Internal/External Actions............................52 9. Object Repository................................................................53 9.1 Per Action/Shared Object Repository:.....................................................................53 9.2 Merging of two object repositories:.........................................................................55 9.3 Limitations:..............................................................................................................57 10. Variables...........................................................................58 10.1 Action Parameters................................................................................................59
Confidential

Page 2 of 100

60761011.doc

QTP Frame Work

10.2 Test Parameters......................................................................................................61 10.3 Environment Variables..........................................................................................63 10.4 Variable passing from one Action to another.......................................................64 10.5 Scope of Variables.................................................................................................66 11. Check Points......................................................................68 11.1 Types of Checkpoints............................................................................................68 11.2 Output Values for Verification..............................................................................70 12. Reusable Library................................................................72 12.1 Introduction...........................................................................................................73 12.2 How to establish a Reusable Library.....................................................................73 12.3 How to use this Reusable Library.........................................................................75 13. Regular Expressions..........................................................75 13.1 Description.............................................................................................................75 14. Recovery Scenario............................................................80 14.1 Exceptional Handling using Recovery Scenarios..................................................81 14.2 Sample for Recovery Scenario:...........................................................................87 15. Optional Steps...................................................................93 15.1 Description:........................................................................................................93 16. Reporting...........................................................................95 16.1 Different Options for Reporting.............................................................................96 16.2 Functions used for Reporting..............................................................................97 16.3 Reporting Formats.................................................................................................99

1. Automation Architecture
1.1 Design

Confidential

Page 3 of 100

60761011.doc QTP Frame Work 1.2 Approach for Test Automation Description Confidential Page 4 of 100 .

where all the transactions including the customized transactions where explained to the SAP Consultants of satyam. Then common functionalities where identified. SAP Consultants. where Reusability was one of the main aspects. Approach for automation begins with finding out the conditions and business rules given by the client and grouping similar conditions. Work done at the offshore was to analyze on the appropriate version of the QTP Tool to be used and to get licenses for QTP. design for automation of scripts was done. where all the transactions. Steps involved in Approach for Test Automation are as follows: • • • • • • • Requirement gathering from the client Understanding and Analyzing the Requirement Grouping the requirement into Test cases Preparing the Design for Automation Building Scripts depending on the Design Review of Scripts at Offshore Delivery to the Client For example in the Unilever project: Since it is Project for Automation of SAP. All the Identified Scenarios which consists of different transactions where explained to Testing Team.60761011. user accounts for SAP access. Depending on the flow of transactions. business rules together as Test cases or Test Scenarios. While SAP Consultants where onsite for gathering Requirements. Automation Framework: For Quality deliverables. all the transactions where grouped together as different scenarios. and grouped together as different Test cases. Testing Team. After defining different Test cases. which are common in the scenarios.doc QTP Frame Work Approach for Test Automation is used for building a strategy for automation starting from the Requirement phase till the deployment phase. Under standing of requirements was done at the client side. are identified as Reusable transactions. important things that should be followed are: • Following common coding structure for all the scripts Page 5 of 100 Confidential . Installation of QTP and SAP. Team was divided into two. Requirement gathering from the client included knowledge transfer at onsite.

output data from the script is also collected and exported to the corresponding sheet. Importing of sheets is done at the beginning before calling other actions and exporting of sheets is done at the last. so that the data in the fields of the Imported sheets are used as input data to the script. were recorded in one script and is reused in all the scripts where the transaction is required.doc • • • • • QTP Frame Work Consistent coding conventions Use of Reusability for making code efficient and minimal Efficient use of Object Repository Use of Error and Exception handling Functions Use of Data table object. Environment variables for using data For example in the Unilever project: Coding Structure used is that there will a main Action for all the scripts which is named as corresponding Test case name.60761011. which ever transaction was common among scripts. all the common types of exceptions or errors are given common Recovery scenarios using regular expressions. Object state and on Error Recoveries. This Action intern will call all the other actions (Each Transaction used in the script would be an action) in the script. Sheets corresponding to all the actions in the scripts are imported. Importing and Exporting of sheets is also done in this main action. which minimized the number of Recovery scenarios and Functions used. Major types of Recovery used in this project where Popup Window. Design for Structure of Scripts used in Unilever Project: Main Action. There are many transactions which are reused in the scripts. In Error handling using Recovery. similar transactions (Actions) are made as reusable so that its not required to record those transactions again and again. Error handling in the unilever automation is done by using Recovery Scenario where each Recovery scenario calls a function which handles the recovery by exiting all the other transactions (actions) when recovery fires. which calls all the other Called Actions Confidential Page 6 of 100 .

60761011.doc Actions (transactions) in the script QTP Frame Work <Action Name> Main Action in the Script Calls <Action Name> Ex: S014_001 (Action Name) Ex: ME21N (Action Name Which is same as the Transaction name in SAP) Confidential Page 7 of 100 .

Naming Conventions & Templates Building the Re-Usable Library Application Login. File Handling. Restoring. Log Reporting.60761011. Data Table handling Error handling. Date handling. messaging etc Script Development using Record & Play back Deliver the script after Verification & Validation Confidential Page 8 of 100 . Logout. Object Repository. Recovery. Common Functionality Related code etc Tool & Application Settings.doc QTP Frame Work Design of the Approach for Test Automation is given below Identification of Test Cases for Automation Identification of Common Functionality Coding Standards. House Keeping etc General library containing String handling.

QTP Framework in SAP Automation Confidential Page 9 of 100 . LT04.60761011. LB01.doc Design for Automation of Test cases for Unilever Foods: QTP Frame Work It’s a description of Automating a test case belongs to SAP by explaining a scenario S014-081 Scenario Objective: Moving a Material from Raw Material Storage Location to a Production Storage Location. LT012 and Logoff. MM03 Recoveries are gAlready_exist. Logout and common functions like LT12. Reporting like reporter. ‘The Action named as per transaction ID’ Building the Re-Usable Library like ‘The common functionality being reused’ Application Login.ReportEvent etc Business Transactions Scripts are LB01 and LT04 Note: The phase in blue color indicates where more efforts are required in analyzing and recording to generate a script. Common Functions are LT12.Scenario name’. MM03 Coding Standards & Naming Conventions like ‘The file name as per convention . Actions for the Transactions Login.qrs S014_164_Materia l_Not_Maintained. Creating a Transfer Requirement and a Transfer Order. qrs Error handling like On Error Resume Next. MM03.

doc QTP Frame Work Test Data Handling and Data Sheet Importing SAP Application Session Login Script for Business Transaction/ Test Case Test Results Reporting and Application Closing.60761011. Re-Usable Library: Generic Library calls for handling data. As Automated testing can be used to verify the performance of application paths that are used with a high degree of frequency when the software is running in full production e. string etc Error handling Library Recovery Scenario Actions Guidelines followed for identification of Test Cases for Automation • Tests that need to run once and those that need frequent human intervention are usually not worth the investment to automate and have not been considered for automation. • Repetitive Testing Confidential Page 10 of 100 .g. creating customer records. Invoicing and other high volume activities where software failure would occur frequently have been considered. date. • • Mission critical processes like core activities like sales order processing are prime candidates for automated testing and have been considered for automation.

This leads to performance issues of the recorded script. This scenario is faced very frequently in enterprise applications as in pricing tables and leads to the complexity of the script and subsequently the effort. Avoiding screens where objects are created dynamically Avoiding business scenarios where complex hardware is involved Selecting a row in a table results in an additional challenge from. Some automation tools provide the facility to read each row in a table and for focusing on a specific row.60761011. Though possible to automate this increases the complexity of the script.doc • • • • • QTP Frame Work Applications with Long Life span – Longer the application in production greater the benefits from automation. Avoiding scenarios that require high degree of coding while automating so that script’s complexity is reduced and high maintainability of the script is ensured. Confidential Introduction to QTP Page 11 of 100 . If the numbers of rows were very high the execution time of the script would be high. Hence. Avoiding dynamic screens. it is better to prove the business scenario wherein tables with row selections figure by identifying a fixed row number. • 2.

60761011.doc

QTP Frame Work

2.1 QTP Environment Compatibility
QTP (version) supports a wide range of working environments and thereby can be used for practically any application. Core Environments Supported by QTP: - Windows applications (MFC) - Visual Basic - Java - ActiveX Enterprise Applications: - SAP - Siebel - PeopleSoft - Oracle Web Technologies: - HTML - DHTML - JavaScript Browsers: - Internet Explorer - Netscape - AOL Emerging Technologies: - .NET winforms, webforms, web services - J2EE Web services - XML, WSDL, UDDI Terminal Emulators: - 3270 - 5250 - VT100 Server Technologies:

Confidential

Page 12 of 100

60761011.doc - Oracle - Microsoft - IBM - BEA - ODBC - COM / COM+ Multimedia: - Flash - RealAudio / RealVideo - Windows Media Player Operating Environment Operating Systems Supported: Databases Supported: Networks Supported: Programming Languages Supported: Windows XP/2000/NT Windows 95/98/ME

QTP Frame Work

(Not Applicable) TCP/IP JavaScript Java HTML Visual Basic (VB) XML Middleware Supported: Microsoft .NET

2.2 Versions of QTP
QTP 6.5: To successfully install and run QTP6.5, following minimum system requirements are required : Computer/Processor: IBM-PC or compatible with a Pentium® II 266 MHz microprocessor (366 MHz recommended). Windows® 98 Second Edition, Windows® 2000— Service Pack 3, Windows NT® 4.0—Service Pack 6a, Windows® Me, or Windows® XP—Service Pack 1.

Operating System:

Confidential

Page 13 of 100

60761011.doc Memory: Free Hard Disk Space: Browser:

QTP Frame Work
128 MB of RAM (256 MB recommended) 150 MB of free disk space for a compact installation or 200 MB for a typical or complete installation Microsoft Internet Explorer 5.0–6.0.

Supported Environments QuickTest Professional supports creating, recording, and running tests in the environments described below. Standard Windows Applications Win32 API MFC Visual Basic Applications Visual Basic 6.0 Browsers
• • • •

Microsoft Internet Explorer 5.01–6.0 (required) Netscape Navigator 4.06–4.7x (optional) Netscape 6.1, Netscape 6.22, and Netscape 6.23 (optional) AOL 5.0 and 6.0 (optional)

ActiveX Grid Controls In addition to basic support of ActiveX properties and methods, QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Grid controls:

Confidential

Page 14 of 100

TDBGrid TrueOleDBGrid60.1 SSDataWidgets.4 FarPoint Spreadsheet 3.5 FarPoint Spreadsheet 3.3 TrueDBGrid50.3 FarPoint Spreadsheet 6 (OLEDB) Microsoft Grid 1.2 Microsoft MonthView Control 6.MonthView.0 Sheridan Data Grid 2.Grid MSDBGrid.fpSpread.TDBGrid TrueDBGrid60.0 Apex True OLE DB Grid 6.0 Sheridan Data Grid 3.0 FarPoint Spreadsheet 3.0 (SP4) MSComCtl2.fpSpread.MSFlexGrid. QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Calendar controls: Name ProgId Microsoft Date and Time Picker Control 6.SSDBGridCtrlApt.fpSpread.DBGrid MSFlexGridLib.0 FPSpreadADO.1 SSDataWidgets.0 Microsoft DataBound Grid 5.1 Apex True DataBound Grid 5.doc Name FarPoint Spreadsheet 2.0 Apex True DataBound Grid 6.2 Confidential Page 15 of 100 .5 (OLEDB) FPSpreadADO.1 FPSpread.0 (SP4) MSComCtl2.DTPicker.5 FarPoint Spreadsheet 6.0 ProgId QTP Frame Work FPSpread.Spread.Spread.4 MSGrid.3 FPSpread.TDBGrid ActiveX Calendar Controls In addition to basic support of ActiveX properties and methods.60761011.2 FPSpread.0 (OLEDB) FPSpreadADO.Spread.2 FarPoint Spreadsheet 3.0 Microsoft Flex Grid 6.Spread.SSDBGridCtrlApt.

• Additional Environments QuickTest Professional add-ins support other environments such as Java. PeopleSoft. contact your sales representative or Mercury Interactive Customer Support.60761011. version 6. and terminal emulator applications. You can also test Macromedia Flash 6 clips containing only Flash 4 or 5 commands.5 supports testing on the following multimedia applications: • • Microsoft Windows MediaPlayer controls. Note for QuickTest Professional 6. Siebel.doc Multimedia Applications QTP Frame Work QTP6.NET Windows and Web Forms. SAP solutions. QTP 8. Oracle. Web Services. .0 and earlier: Java support and Oracle support are now available as separate add-ins to QuickTest Professional 6.0: Confidential Page 16 of 100 .0 and higher RealPlayer controls supported for Internet Explorer browsers (the controls within applications containing browser controls are not supported) Macromedia Flash 4 or 5 objects that are ActiveX controls in Internet Explorer. For more information about QuickTest Professional add-ins.5 and are no longer part of the core product.

128 MB of RAM (256 MB recommended). or Windows 2003 Server.NET Add-in 6.5 Terminal Emulator Add-in 6. Free Hard Disk Space: Browser: Supported Add-ins The following external QuickTest 6. After Quick Test Professional is installed.5 Service Pack 2-6.0: • • • • • • Java Add-in 6.60761011.5 PeopleSoft Add-in 6.5.5. Windows 2000-Service Pack 3 or Service Pack 4.0. and an additional 120 MB of free disk space on the system disk (the disk on which the operating system is installed).5 .5 Oracle Add-in 6. 250 MB of free disk space for application files and folders.doc QTP Frame Work System Requirements To successfully install and run QTP8. Microsoft Internet Explorer 5. you need the following minimum system requirements: Computer/Processor: Operating System: Memory: IBM-PC or compatible with a Pentium II 266 MHz microprocessor (366 MHz recommended).1 Confidential Page 17 of 100 .x add-ins are supported for use with QuickTest Professional 8. it is recommended to have at least 150 MB free disk space on the system disk for the operating system and Quick Test Professional to run correctly.0.5. Windows XP-Service Pack 1.1 SAP solutions Add-in 6.

the Add-in for SAP solutions 6.1.0 (required) Netscape 6. Standard Windows Applications 1. and Netscape 7. and running tests or components using the environments and programs described below.0 Note: Visual Basic .NET Add-in 6.0 and 9.5. Netscape 6.Win32 API 2. QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Grid controls: Confidential Page 18 of 100 .doc QTP Frame Work Note: Siebel Add-in 6.1 (optional) • AOL 8.60761011.cannot be used with QuickTest Professional 8.1 Supported Environments and Programs QuickTest Professional 8. Netscape 7. or any 6.MFC Visual Basic Applications Visual Basic 6.0 add-ins. the . recording.0 supports creating.5.NET Add-in.02.NET applications are supported by the QuickTest Professional .5 Service Pack 2-6.5.23. Browsers • Microsoft Internet Explorer 5.0.22. Netscape 6.0 (optional) • ActiveX Grid Controls In addition to basic support of ActiveX properties and methods.

5 FarPoint Spreadsheet 6.Grid MSDBGrid. QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Calendar controls: Name ProgId Microsoft Date and Time Picker Control 6.0 Microsoft DataBound Grid 5.Spread.MonthView.fpSpread.4 MSGrid.Spread.2 FPSpread.4 FarPoint Spreadsheet 3.DTPicker.fpSpread.1 SSDataWidgets.SSDBGridCtrlApt.Spread.2 Confidential Page 19 of 100 .0 Sheridan Data Grid 3.TDBGrid TrueOleDBGrid60.0 ProgId QTP Frame Work FPSpread.1 Apex True DataBound Grid 5.5 (OLEDB) FPSpreadADO.3 FPSpread.60761011.TDBGrid ActiveX Calendar Controls In addition to built-in support for ActiveX properties and methods.0 FarPoint Spreadsheet 3.0 Sheridan Data Grid 2.3 TrueDBGrid50.0 (SP4) MSComCtl2.1 SSDataWidgets.DBGrid MSFlexGridLib.SSDBGridCtrlApt.0 Apex True OLE DB Grid 6.2 Microsoft MonthView Control 6.0 FPSpreadADO.0 Apex True DataBound Grid 6.doc Name FarPoint Spreadsheet 2.0 Microsoft Flex Grid 6.0 (SP4) MSComCtl2.5 FarPoint Spreadsheet 3.MSFlexGrid.TDBGrid TrueDBGrid60.2 FarPoint Spreadsheet 3.1 FPSpread.3 FarPoint Spreadsheet 6 (OLEDB) Microsoft Grid 1.Spread.0 (OLEDB) FPSpreadADO.fpSpread.

2002. and XP. 2003. Additional Environments QuickTest Professional add-ins support other environments such as Java. Confidential Page 20 of 100 . PeopleSoft. SAP Solutions. and terminal emulator applications. you can work with Microsoft Excel 2000.0 (for example. to import or export data to or from the Data Table). Siebel. . Microsoft Query When using Microsoft Query with QuickTest Professional 8. 2002. contact your sales representative or Mercury Interactive Customer Support. for Database checkpoints).NET Windows and Web Forms. For more information on QuickTest Professional add-ins.doc QTP Frame Work Microsoft Excel When using Microsoft Excel files with QuickTest Professional 8.0(for example. Oracle. Web Services. 2003. you can work with Microsoft Query 2000. and XP.60761011.

5.1 Sap add-in 6. you will need to get the 6.0.5 Add-ins Siebel add-in 8.5 Default Add-Ins: Active X Controls.0 cannot be used with Quick Test 8. If you are using Quick Test Professional 6. Confidential Page 21 of 100 .0 6. Web Note: Quick Test Professional Siebel add-in 6.5 .5 PeopleSoft add-in 6.5.1 Java add-in 6.5 Terminal Emulator add-in 6.60761011.5. Add-Ins 3. Web &Visual Basic .5 Oracle add-in 6.2 Java add-in 6.5 version of your add-in. Web &Visual Basic 8.doc QTP Frame Work 3.5. Visual Basic.0 Terminal Emulator add-in 8.5 Oracle add-in 6.0 cannot be used with Quick Test Professional 6. Net Web Java XML Default Add-Ins: Active X controls.0 .1 Types of Add-Ins QTP version 8.5 and Web services add-in 6.2 Default Add-Ins: Active X Controls. • The add-ins for Quick Test Professional 6. Net add-in 6. Multimedia. Net add-in 8.

it is required to use the . When testing Java applets in a Web browser web Add-in as well as java add-in must be loaded . However. you must load the Web add-in as well as the Java Add-in. it is a plain HTML page.2.Net Add-In The . Labels can be identified only if SAP Add-in is installed.2 . parameterize a step. Quick Test Professional can recognize HTML controls like edit fields.Net like ASP.Net add-in to achieve object recognition.In some cases. when the page is sent to the browser.2. To test Java applets or applications running on Netscape 4.doc QTP Frame Work 3.2.Net add-in. the Java Add-in must be loaded. buttons etc. confirm that the Netscape 4. without the .Net server controls.Net.60761011.Net add-in is required to support objects developed in .3 Sap Add-In The Sap add-in is required for all SAP applications.1 Java Add-In When testing Java applets in a Web browser. 3. 3.To create a checkpoint. even though the application has been developed using .Net .x browser is already installed before installing the Quick Test Professional Java Add-in. Confidential Page 22 of 100 . and use the Web tab of the Record and Run Settings Dialog box to specify your record and run preferences. In SAP application Grid Tables. or to add a method from individual java applets.2 Conditions for Add-ins 3. if a Web application contains complex controls like ActiveX or other controls developed in . Status Bar messages.x’s built-in JVM (not Java Plug-ins).

Use Case Or Scenario For example: Example 1: Considering that Each Use case is associated with one Test case. Every Test Case contains one or more Conditions. Script naming should be done consistently with clarity and traceability.2 Script and Action Naming Conventions: Similar to the Test case naming. in those modules different transactions are grouped together as a scenario. Test Case 4. Scripts and Actions vary from Project to Project depending upon the Client. if S014_01 is the scenario name.60761011. SAP transactions are divided into different modules. Conventions The Conventions for Naming for test cases. For Module IMWM. so name of the test case for the S014_01 scenario was given as IMWM_S014_01. Confidential Page 23 of 100 . Example 2: In the Unilever Automation Project. Consistency should be maintained in following the hierarchy of naming. 4. If the name of the Use Case were UC_001 then the Test case name would be TC_001. Typically each Test Script is prepared corresponding to each Test Case. The Onlooker should be able to trace the test case back to the use cane name or Scenario name by the name of the Test Case.1 Test Case Naming Conventions: Test cases should be named in a manner that enables easy identification of the corresponding Use case (or the Scenario) for which the Test Case is written.doc QTP Frame Work 4. so for writing the test case for a particular scenario naming convention used is module name followed by scenario name. Each Condition can be represented by an action in the script.

Action Naming: Each Test Script can contain one or more Actions. 1. Actions can be named in 2 ways: 1. Example: REUSE_Login. with one or more actions representing a test Condition. For E. Functionality of the Action 2.: TC_01_014 would have a QTP Test Script as QTS_01_014. Functionality of the Action: Typically Actions are segregated by their functionality in the Test Script. When an Action is to be made reusable the action should be named as REUSE_(Action name). Confidential Page 24 of 100 . This also adds a huge advantage when the Actions are made reusable.: An Action written or recorded for logging the user should be named as Login or Authentication for easy understandability. Reusable Actions can be used between various scripts.g. An Action for booking tickets should be named as Book_Tickets An Action for exiting the application named as Exit.g.doc QTP Frame Work Use Case Test Case Condition1 Condition2 Condition3 ……… Test Case Condition 1 Condition2 Test script Action1 Action2 Therefore for a Test Script corresponding to a Test Case named TC_001 would be QTS_001.60761011. Therefore it would be easier to understand the Action if the name of the action represents the Functionality. E. Hierarchy of the Action in the Test Script.The hierarchy should be maintained in case the use cases or test cases are nested.

I'm using just six prefixes: Prefix b d i o s u Data Types Boolean (true or false) Example bChecked = True Date/time dStartTime = Now All numeric data types iTax = iPrice * 0. your variables always indicate what they are designed for. Double) Objects Set oFile = Nothing Strings sTitle = "Welcome!" User interface elements uPara. For e. Actions can be named as per Hierarchy.title = cTitle Confidential Page 25 of 100 .: Test Case Name  TC_01 QTP Test Script Name  QTS_01 Name of 1st action in the Script  QTS_01_01 Similarly Name of 9th Action in the ScriptQTS_01_09 4. Const cTitle = "Welcome!" UDocument. Hierarchy of the Action in the Script: Since Actions are a part of the Test Script. Currency. Long. Therefore.076 (Byte. for purpose of Clarity and tracking. Integer. Indicating the data type therefore is less important for constants.3 Variables and Constants: QTP Scripts are in VB Script. the naming conventions for variables can be followed alike VB Script Naming Conventions. Prefix letter c for all constants can be used.g. e.doc QTP Frame Work 2.g. Single. General Conventions followed in VBScript are: Data Type Prefixes: By using data type prefixes.60761011.style.display = "block" Constants Prefix: Usually there are only a handful of constants in any scripts.

named after the Action to which it belongs.60761011. which is a common sheet for all the actions of the script. IN_iIncrement etc. can be used efficiently for the data sheet too. ‘In’ denoting that it’s an input parameter for the Test in whole. Example: ACTIN_iResult b) Action Output Parameters: These could be named as ACTOUT_(var name). which is local to the Action. These can be named as ACTIN_(variable name). OUT representing that it’s an output parameter. This is by default.doc QTP Frame Work 4. Typically. Example: OUT_sStatus. which when named following its naming conventions. 2) Action Parameters a) Action Input Parameters: These are local to Action of a Test. Parameter Naming: Various Types of Parameters used in QTP are: 1) Test Parameters a) Test Input Parameters: These should be named as IN_(relevant variable name). Therefore the name of the datasheet follows directly the name of the Action. Each Action in the Script contains one data sheet. is named by default as dt_globalsheet. This should also comply with the standard variable naming conventions. these should be named as OUT_(relevant variable name). b) Test Output Parameters: On the similar lines of Input Parameters. ACTIN denoting that it’s an Action Input Parameter. Example: IN_bFlag. 1.4 DataSheet Naming and Parameter Naming Conventions: Every QTP Test Script contains 2 types of sheets. Global data sheet 2. Local data sheets The Global data sheet. This can be renamed as Global for all the Scripts for consistency. The name following IN should be a relevant name for the variable.. Confidential Page 26 of 100 . denoting the purpose of its use.

so their naming convention is not discussed. Example: Func_Save . User Defined Environment Variables are either Internal or External. This can provide clarity and difference between a Reusable Action and a Function that can be used within Actions.doc Example: ACTOUT_bFlag QTP Frame Work 3) Environment Variables: Environment variables are either built-in or User defined. Built-in variables cannot be declared named by the user.5 Function Naming Conventions Functions should be named as Func_(name).60761011. Func_Add Confidential Page 27 of 100 . Internal Variables: ENV_INT_(variable name) External Variables: ENV_EXT_(Variable name) 4.

60761011.doc

QTP Frame Work

5. Settings
5.1 QTP Test Settings
Before Running or Recording any test on QTP, the QTP Test settings need to be set as per the requirements of the Test. Setting these Test Settings before starting a Test plays a crucial part in the behavior of the test. These can be found at the path Test>Settings. A dialog box pops up, in which various tabs are present which allow one to set • Properties of the test like Add-Ins used • Run time Preferences • Resources like files, data tables, and repository to be used. • Parameters required in the Test. • Environment variables used • Web navigation • Recovery Scenarios

Note: For further details about the use of each tab, refer to QTP Test Settings

Confidential

Page 28 of 100

60761011.doc

QTP Frame Work

5.2 Record and Run Settings
After Setting the Test Settings at Test>Settings, the next important settings for actually recording the application and running it for Testing are to be set at the Test>Record and Run Settings. This dialog box opens automatically, when recording a test for the first time. The details of which application to record are set in this dialog box.

For further details about these settings refer to Record and Run Settings.

5.3 Active Screen Capture Level
One of the most useful fetaures of QTP is the various views it provides, out of which Active view is the most unique.The selection of the appropriate Active Screen Capture level influences the storage space, properties stored and the view of the Active screen. The selection can be made by going to Tools>Options>Active Screen. The Active screen settings can also set at the Test>Record and Run Settings. The active screen capture level can be set to any of the 4 levels i.e. Complete, Partial, Minimum and None.

Confidential

Page 29 of 100

60761011.doc

QTP Frame Work

For details about each capture level, refer to ActiveScreen Capture Level.

5.4 Object Repository
When a test is recorded, QTP adds each object on which an operation is performed, to the Tools>object repository. Objects can be added to the repository while editing the tests too.While recording, Objects are added to the repository in either of the two ways: a. Object Repository per Action b. Shared Object Repository.

Confidential

Page 30 of 100

spy objects.60761011. objects are identified and separated on the basis of each action and the corresponding object repository for the test is created in the test folder. Confidential Page 31 of 100 .doc QTP Frame Work The settings can be changed by going to Test>Settings>Resources>Object Repository Type In the Per-Action mode.In the Shared mode.and their properties can be seen and manipulated in the Tools>Object Repository. the user may choose a location to save the shared object repository files for all the tests. find and replace property values etc.There are provisions in this Object Repository Dialog box to add new objects. All the Objects recorded during a test.

Add. Active Screen View: Pictorial view of the currently active Screen. Add Objects : A Button to add new objects to the repository. Replace. d. the various representations of the Script.doc QTP Frame Work The First Section of Object Repository Dialog Box contains provisions to a. c. Export: To Export any objects to an outside location. when the application is open. Keyword View: Hierarchical Representation of Actions c. They are a. Confidential Page 32 of 100 . The second section of the dialog box contains provision to Find. there are 3 important views that enable us to understand clearly. 5. Highlight: To highlight the object selected in the repository. to see its Properties. b.60761011. Object Spy: To Spy any Object. and Remove the properties of an object in the Repository also set any default values for the properties.5 Expert View While recording Tests in QTP. Expert View b.

a corresponding row exists in the Keyword View and a corresponding Active Screen in the Active Screen view.doc QTP Frame Work In the Expert View. For each object and method in an Expert View statement. QTP displays each operation performed on the application in the form of a script. The script is comprised of VBScript statements and the view is a script editor with many script editing capabilities.60761011. Fig: Active Screen Component corresponding to Expert View Statement Confidential Page 33 of 100 . which enables easy traceability.

Datatables etc.60761011... the user can add and update statements and enhance the tests and components with programming.whenever a step is added to a script.5.1 Step Generator: If the user is familiar with VBScript.These additional steps can be added either manually or using Insert>Step >Step Generator . its power and flexibility can be increased by adding recordable and non-recordable VBScript statements as required for tasks like Check Points. After the test or an Action is recorded. then any Syntax errors of the step can be Identified in its Keyword view.doc QTP Frame Work Fig: Keyword view and Active Screen view corresponding to one expert view statement 5. Confidential Page 34 of 100 .

doc QTP Frame Work The Step Generator enables you to add steps quickly and easily.6 Setting related to the Application Used: The different kind of Applications that can be tested using QTP are windows applications.Oracle etc. rest all applications require a special Add-in to be purchased to do the testing. VBScript functions.The generated step gets added at the position of cursor in the expert view.SAP. In the Step Generator dialog box you can define steps that use: • test object methods and properties • utility object methods and properties • calls to library functions. The Step Generator enables you to add steps quickly and easily. by selecting from a range of context-sensitive options and entering the required values. by selecting from a range of context-sensitive options and entering the required values.Each Confidential Page 35 of 100 .web based(java and .Apart from the windows applications using MFC and simple web applications(which can be run with default addins).Net). and internal script functions 5.60761011.

results in a new tab in all the setting dialog boxes .60761011.doc QTP Frame Work Add-in which is bought and installed.It purely depends on the type of application . how to choose a particular setting option. Example of a SAP Add-in : Fig: The Add-in manager dialog with SAP add-in Confidential Page 36 of 100 . using which various setting options can be chosen.

doc QTP Frame Work Fig: Record and Run Settings with a SAP Add-in. Confidential Page 37 of 100 .60761011. For detailed information of the settings of the tabs other than the special tabs refer Record and run settings.

Property: Property describes about the object defined. which differentiates the given object with other objects. minimize etc. Activate is a method used to activate the window object. For example: If we take a window object. which are used for changing the properties of the object that is in order to manipulate with the object properties we use. maximize. Confidential Page 38 of 100 . which is necessary to describe the object. Exist is a property which is common to many objects which returns true if that object exists. Activate.doc QTP Frame Work 6.1 Objects Objects are the things which contains different properties and methods. thus the window object will be activated if not in activated mode. each object has different properties. we first have to define to which class it belongs to which is one of the property. thus by using Activate method Activate property of the present window object is set to true. GetROProperty and methods such as ChildObjects. For Example: Window is said to be an object which consists of properties such as Exist. For example: If we take a window object. Methods: Methods are functions.60761011. Objects 6. it belongs to a window class.

This objects contain child objects. here Set is the method used to set a text into the WinEdit object. there are two main Objects.60761011. one is Dialog and the other is Window object.doc QTP Frame Work Sample for Object hierarchy: Method for “WinEdit” Object “Dialog” Object Child Object for “Dialog” Object In the above sample of code. For Dialog object which is named as “Login” has WinEdit object with name as “Agent Name:” as childobject. Dialog Parent Object named as “Login” Child Object named as “Agent WinEdit Name:” “Set” is the method associated with “WinEdit” object Confidential Page 39 of 100 .

AddSheet(“Sheetname”). “Nameofthesheet”) • • Addsheet : Used for adding a sheet into the script file. 7. One of the Objects used in QTP scripting is DataTable Object. Syntax: Datatable. “nameofthesourcesheet”. GetRowCount: This function is used to get the no of rows in a particular sheet. Main functions of the datatable object: • Importsheet : This function is used to Import sheet into the script.doc QTP Frame Work 7. updating data of an excel sheet used.1 Datatable Object and related Functions: Description Basic use of Datatable object is to create an object for adding. all the data including output values are stored in the default sheet for the action. Syntax: Datatable.Importsheet(“nameofExcelfilewithpath”. “nameofthedestinationsheet”) • Exportsheet : This function is used to Export sheet from the script. so that all the data in the imported sheet can be used in the script. this sheet is exported and stored in a specified location using this function. deleting.GetRowCount Confidential Page 40 of 100 . Data Table In QTP scripting there are many objects that are used.Exportsheet(“nameofExcelfilewithpath”. Syntax: Datatable.60761011.

Value(“Fieldname”.doc QTP Frame Work • GetCurrentRow: This function is used to get the current row of a particular sheet.GetSheet(“Sheetname”). For using the data from the Local sheet we use following function: Datatable. that action will run as many times as the number of rows in the excel sheet of the action.”Sheetname”) Confidential Page 41 of 100 .Value(“Fieldname”.Value(“Fieldname”.”Global”) Localsheet: Each and every action in the script will have its own Localsheet. When an action is run by using run setting as “run on all rows”. Globalsheet is used in order to store values in the sheet and the values stored in Globalsheet can be used in all the actions. they are Globalsheet Localsheet Globalsheet: Globalsheet in any script is unique.Value(“Fieldname”. Syntax: Datatable. For storing a value in the global sheet we use the following function: Datatable.2 Organizing Data Sheets for Global & Local variables Description There are two types of sheets in any QTP Script. name of the Localsheet of a particular action is same as the action name.”Global”) = Value For using the values from the global sheet we use the following function: Value = Datatable.60761011.dtlocalsheet) Or Datatable.GetCurrentRow 7. in order to find the row for which action is running currently we use GetCurrentRow function.

3 Parameterizing using Data driven Wizard Description The Data Driver enables you to quickly parameterize several (or all) property values for test objects. You can choose to replace all occurrences of a selected constant value with a parameter.doc QTP Frame Work Organization of Global and Local sheets with the actions used in the script are shown below: Action name: “Login” Local Sheet for “Login” Action Global Sheet 7.60761011. QuickTest can also show you each occurrence of the constant so that you can decide whether or not to parameterize the value. that property can be parameterized using Data driven Wizard. Confidential Page 42 of 100 . in the same way that you can use a Find and Replace All operation instead of a step-by-step Find and Replace process. checkpoints. and/or method arguments containing the same constant value within a given action. If any property of an object is taken.

e. for all the objects where a value for a property is given in the script) For example consider script for entering Login name which is as follows Dialog("Login").60761011.WinEdit("Agent Name:").doc QTP Frame Work Different steps for parameterization using Data driven Wizard is as follows: • • Go to tool bar option Tools and select Data Driver option We will get a list of all the properties of all the objects which can be parameterized (i. There will be two options to be selected as given below: Confidential Page 43 of 100 .Set "name" The Set property of WinEdit Object appears in the list of Datadriver with “name” as Value representing the Set property of “Agent Name” Editbox. which is as given below: • • Select a value which should be parameterized and click on “Parameterize” button.

For each step. this will enable us to select an other instance of the constant selected and parameterize that instant.60761011.doc QTP Frame Work Step-by-step Parameterization: Enables you to view the current values of each step containing the selected value. which parameterization options you want to use. and if so. the Next button is enabled when you select this option. Confidential Page 44 of 100 . you can choose whether or not to parameterize the value. it will continue the same process till all the instances of the given value are done.

60761011.doc QTP Frame Work Parameterize all: Enables you to parameterize all occurrences of the selected value throughout the action. Confidential Page 45 of 100 . The Finish button is enabled when you select this option. When you select this option the Parameter details area is enabled.

The data in the imported sheet replaces the data in the destination sheet (see SheetDest argument).60761011.doc QTP Frame Work Here Parameter tab can be selected using the button given at the “Parameter” radio button. Confidential Page 46 of 100 . click on “Finish” button thus all the instances of the value selected for parameterization will be parameterized. writing and manipulating the data in an excel sheet. and in the next screen select the datatable Field from where the property for which the value belongs is parametererized. 7.4 Importing and Exporting Datasheets: Description Importing and Exporting of Datasheets are used for reading. Importing Datasheet: Description Imports a sheet of a specified file to a specified sheet in the run-time Data Table.

the sheet is inserted as the last sheet of the file. Importing the whole excel file and Importing the sheets in the file. Same as Importing.”sourcesheetname”. If the current file exists and the file contains the specified sheet. Function for Importing the whole Excel file: Imports the file into the script with all the sheets which are there in the excel file. There are two functions for Importing. since action name and corresponding sheet name should be same. Confidential Page 47 of 100 . but the file does not contain a sheet with the specified sheet name. Syntax: Importsheet “filenamewithpath”. • • • If the specified file does not exist. Exporting the whole excel file and Exporting the sheets in the file. Function for Exporting the whole Excel file: Exports the file into the script with all the sheets which are there in the excel file. If the current file exists. ”destinationsheetname” Exporting Datasheet: Description Exports a specified sheet of the run-time Data Table to the specified file. Syntax: Import “filenamewithpath” Function for Importing the sheets from the excel file: Imports the specified sheet into the script.doc QTP Frame Work Note: All the fields in the imported sheets should match with the data used in the script. Note: Sheets in the excel file should match with the Actions in the script to use the data efficiently. the exported sheet overwrites the existing sheet.60761011. a new file is created and the specified sheet is saved. There are two functions for Exporting.

”sourcesheetname”. ”destinationsheetname” QTP Frame Work Confidential Page 48 of 100 .doc Syntax: Export “filenamewithpath” Function for Exporting the sheets from the excel file: Exports the specified sheet into the script.60761011. Syntax: Exportsheet “filenamewithpath”.

Actions 8.doc QTP Frame Work 8. or to run iterations only for certain rows in the Data Table.60761011.1 Actions Settings You can use the Run tab of the Action Call Properties dialog box to instruct QuickTest to run only one iteration on the called action. Confidential Page 49 of 100 . to run iterations on all rows in the Data Table.

using the row in the action's data sheet that corresponds to the current global iteration number. If you choose to run one iteration only for the action and you choose to run iterations on all rows of the global data sheet. In the third and subsequent iterations of the test.60761011. For example.doc QTP Frame Work 8.2 Iterations using rows The Run tab includes the following options: Option Description Runs the called action only once. suppose an action's data sheet has two rows and the global sheet has four rows. Data Table parameters in the action take data from the first row of the action's data sheet. The data that the action parameters use during each repetition of the test are based on the iteration number for the test. If the action's data sheet contains fewer rows than the global sheet. the last row of the action's data sheet. Run one iteration only Run on all rows Run from row __ to row __ The Run tab of the Action Call Properties dialog box applies to individual action calls and refers to the rows in the action's data sheet.e. Data Table parameters in the action take data from the second row of the action's data sheet. the last row of the action's data sheet is used for each subsequent test iteration. In the second iteration of the test. Runs the called action with the number of iterations according to the number of rows in the action's Data Table. then during each iteration of the test. the Data Table parameters in the action continue to take data from the second i. Confidential Page 50 of 100 . During the first iteration of the test. Runs the called action with the number of iterations according to the specified row range. this action will run only one iteration.

Save the text file as ActionTemplate.xls) file. The option area Other location instructs Quick Test to use data stored in the specified Data Table location. To create an action template: 1.60761011. Include action template for every test containing script id. An action template applies only to actions created on your computer. function calls. if you always enter your name as the author of an action.mst is recognized as an action template. Confidential Page 51 of 100 . 2.3 Action Template Creating an Action Template If you want to include one or more statements in every new action in your test. Only the file name ActionTemplate. scenario must be specified with an appropriate name. you can create an action template. Action name. Example: The Resources tab of the Test Settings dialog box can be used to associate specific files with the test. To view the Action template refer to ActionTemplate. you can add this comment line to your action template.mst 8. and other statements that you want to include in your action template. The text file must be in the structure and format used in the Expert View. Action Description. All new actions you create contain the script lines from the action template. The Data Table can be any Microsoft Excel (. Check for mandatory input fields for all iterations in the datasheets that are being imported. Every action. Create a text file containing the comments.mst in your <QuickTest Installation Folder>\dat folder.doc QTP Frame Work 8. Recovery scenario used etc. such as Data Table files.4 Script Startup • • • • Check for the required add-ins for an application. For example.

doc QTP Frame Work For a sample external file refer to Sample External File • Check for the “Data table iterations” under the test settings for which the test has to be run. When you create a new test. Re-usable Actions. A test is made up of calls to actions. Confidential Page 52 of 100 . specific activities that you perform in your application. 8. Internal/External Actions Actions help divide your test into logical units. to make the design more modular and efficient tests.60761011. it contains a call to a single action or create tests that call multiple actions by inserting calls to them.5 Splitting Actions. For further details refer to QTP test settings doc.

• Non-resuable-actions —an action that can be called only in the test with which it is stored. and can be called only once. • external action—a reusable action stored with another test.1 Per Action/Shared Object Repository: Confidential Page 53 of 100 . Object Repository 9. They can be modified only in the test with which they are stored. 9.60761011. • For further details on creation & splitting of actions refer to Actions. External actions are read-only in the calling test.doc There are three kinds of actions: QTP Frame Work reusable action—an action that can be called multiple times by the test with which is stored in the local test as well as by other tests.

60761011. In the Object repository type box. 2. Below are some of the factors based on which Per Action option is selected Confidential Page 54 of 100 .doc Setting the Shared /per action Object Repository option QTP Frame Work To set only one test to use the Shared Object Repository option: 1. 4. select one of the options: • Select "Per-action" to set the Object Repository mode for your test to the Object Repository per action mode. 3. Select the Resources tab. Go to Test -> Settings. Click the "New" button or go to File -> New to open a new test.

specify the Shared Object Repository file you want to use as the test's Object Repository file. Click the "Set as Default" button. 4. Select the Shared option for the "Object-repository type". Note: These steps need to be done in a new script.tsr) from the Open dialog box. Loading of per Action object repository takes less time as the size is less Select "Shared" to set the Object Repository mode for your test to the Shared Object Repository mode.. enter the Object Repository file name or click the ellipse button <.tsr) from the Open dialog box. Click the New button or go to File -> New to open a new test. 9. If you selected Shared in step 4. enter a new file name in the Shared box. Click <Apply> and <OK>.> and select a resource file (*. 2. Go to Test -> Settings.doc • • • • QTP Frame Work Whenever there are no common objects across transactions Ease of building object repository.. 3.2 Merging of two object repositories: General: Confidential Page 55 of 100 . Select the Resources tab. To set all new scripts to use a Shared Object Repository: For Quick Test Professional 6. 6. To specify a file.60761011. you will not be able to change the option. To create a new Shared Object Repository file. enter the Object Repository file name or click the "Browse" button and select a resource file (*. To create a new Shared Object Repository file. 5. Once you have modified the script. Specify the Shared Object Repository file you want to use as the test's Object Repository file. Below are some of the factors based on which Shared Action option is selected • • • Whenever there are common objects across transactions Maintenance of object repository is very easy Whenever size of object repository is 1MB 5. To specify a file. 7.5 and above 1. enter a new file name and path in the Shared box.

Note: The Merge Utility works only on machines where QTP8. Due to the nature of the operation it is often not the case. For example. or decide to keep two objects that for the inexperienced eye would seem identical. Resolving Conflicts: It is not trivial to identify and handle conflicting objects. but different descriptive properties. It is also likely that if the text on a button has changed. It is therefore possible to either keep the two objects (and their subtrees) separated. Conflicts: The implementation of the merge algorithm is quite simple when the object repository files have different objects in them. or to ignore one of the conflicting object. new tests would record a new logical name for it. if we try to merge two object repositories from tests that were recorded at different time points.doc QTP Frame Work The Object Repository File Merge Utility allows users to merge object repository files into a single file. two objects will exist with different logical names. We will discuss these choices later in detail. between which some test objects properties have changed (e. to assume that the two objects are actually the same object. We call this a name conflict. This utility is intended for an advanced user that builds powerful tests. even though the object behavior has not changed. It can also be that the user has decided to modify the automatically assigned logical name of an object (for example.g. but with the same descriptive properties. In this case. We call this a description conflict as the two objects have the same name. For example. in order to create a shorter name) in one repository but not in the other.60761011. The Merge Utility allows you to merge the content of one Object Repository to another one thus giving you the flexibility and the power in controlling the content of the Object Repository and the ability to dynamically change this content. or if all objects had only exact replicas in other files. whether a button is enabled) then the same object exists in the two repositories with different properties.0 is installed. Merge Object Repositories Utility Main Window: This utility is designed to supply simple access to the functionality implemented by the Confidential Page 56 of 100 . The user might want to merge two objects that were not initially the same. recording on web browsers would likely generate identical logical names for browsers that have nothing in common.

2. The reason is that each Action has a data table sheet. The Formula 1 control has a limitation of 255 sheets so the limitation is 255 Actions per test. Confidential Page 57 of 100 . The limitation on the number of Actions is 255.60761011. the UI has many options to select. Mercury Interactive recommends that you keep the Object Repository under 1 MB and perform regular backups. For different options of Merging refer to Merging of Object Repositories.3 Limitations: 1. As the operation is not trivial.doc QTP Frame Work ObjectRepositoryMgr COM component. If the size crosses more than 1MB loading of object repository takes lot of time . however those Actions will not be able to access a local data sheet. so we will discuss the different options in detail. You may be able to add additional Actions after reaching the 255 "limit". 9.

Example: In a new script. This can be accomplished if you are calling the same Action more than one time within the script.60761011. you will see the data sheet added to the data table. The data sheet will not be added again.doc QTP Frame Work Note: If you are calling reusable Actions. The data sheet for the Action will only be loaded once. They are: Confidential Page 58 of 100 . you may be able to have more than 255 Actions within the script. Variables In QTP scripting there are mainly 3 types of variable that we use. This applies to "call to" Actions only. insert a "call to" a reusable Action. 10. Insert another "call to" to the same Action. When the Action is added to the script.

doc • • • Action Parameters. Setting Action Parameters You can specify input parameters for an action so that steps in the action can use values supplied from elsewhere in the test. you can output a value from a step in a nested action and store it in an output action parameter. You define the parameters that an action can receive and the output values that it can return in the Parameters tab of the Action Properties dialog box. modify.1 Action Parameters Action parameters enable you to transfer values between actions and their nested actions in your test. For example.60761011. You can also specify output parameters for an action. Confidential Page 59 of 100 . and then use that value as input in a later step in the calling parent action. Environment Variables. You can specify output parameters for an action. For each input or output action parameter. QTP Frame Work 10. or from a step in a toplevel action back to the script or action that ran (called) your test. You can define. so that it can return values for use later in the test. you define a name and a type. which we declare in the script. You can specify input parameters for an action so it can receive input values from elsewhere in the test. from your test to a top-level action. or you can use the default value that QuickTest provides for the parameter value type that you choose. Input values for an action can be retrieved from the test (for a toplevel action) or from the parameters of the action that calls it (for a nested action). so that it can output values for use later in the test. You specify the actual values that are provided to these parameters and the locations in which the output values are stored in the Parameter Values tab in the Action Call Properties dialog box. Input values for an action parameter can be retrieved from the test (for a top-level action) or from the parameters of the action that calls it (for a nested action). VB Variables. You can also specify a default value for each action input parameter. The default value is saved with the action and is used by the action if a value is not defined for a parameter in the action call. or pass values back to the application that ran (called) the test. and delete input and output parameters in the Parameters tab of the Action Properties dialog box.

The default value is an empty string. If you select a Boolean value type. for example. o Boolean—A true or false value.60761011. Click the Add button next to the Input parameters or Output parameters lists to add a new parameter to the appropriate list. Click in the Name box and enter a name for the parameter. If you enter a value and do not include the quotation marks. you can click in the Default Value column and click the arrow to open a calendar from which you can select a date. You can select one of the following types: o String—A character string enclosed within a pair of quotation marks. you can click in the Default Value column and click the arrow to select a True or False value. for example. Confidential Page 60 of 100 . QuickTest adds them automatically when the value is inserted in the script during the test run. The default value is True. Select the value type for the parameter in the Type box.doc QTP Frame Work To add a new input or output action parameter: 1. If you select a Date value type. "New York". The default value is today's date. 2. A row for the new parameter is added to the relevant list. o Date—A date string. 3/2/2005. 3.

Select the parameter you want to modify from the Input parameters or Output parameters list. The parameter is removed from the list. For example. if you intend to use the value later as a string. You can also use the Parameters tab to modify or delete existing test or component parameters Confidential Page 61 of 100 . If you are editing an existing value. Click the Delete button .doc o QTP Frame Work Number—Any positive or negative number. Password—An encrypted password value. 5. which accepts any of the above value types. click in the Description box. then enter a description of the parameter. you can define input parameters that pass values into your test or component and output parameters that pass values from your test or component to external sources. you must specify the value in the format that is required in the location where you intend to use the value. Select the parameter you want to delete from the Input parameters or Output parameters list. If you select a Password value type. click in the Default Value box and enter a default value for the parameter or you can leave the default value provided by QuickTest for the parameter value type. you must enclose it in quotation marks. The default value is required so that you can run the action without receiving parameter values from elsewhere in the test. the password characters are masked when you enter the password in the Default Value field. for example.60761011. If you wish. Modify the values as necessary in the edit boxes of the parameter row. 2. To delete an existing action parameter: 1. The default value is 0. The default value is an empty string. 4. If the value is not a number. Note that if you select the Any value type. If you are defining an input action parameter. The default value is an empty string.2 Test Parameters In the Parameters tab of Test Settings. QuickTest checks whether it is a number. o To modify an existing action parameter: 1. the purpose of the parameter in the action. 2. 10. QuickTest automatically encloses it in quotation marks if the previous value had quotation marks. QuickTest automatically encloses it in quotation marks. When you specify a value of Any type. o Any—A variant value type.

You can add and delete input and output parameters for your test or component using the parameter control buttons: Option Description Confidential Page 62 of 100 . • Output parameters—Specifies the parameters that pass values to sources that are external to the test or component. • You can edit an existing parameter by selecting it in the appropriate list and modifying its details.60761011.doc QTP Frame Work The Parameters tab contains two parameter lists: Input parameters—Specifies the parameters that receive values from sources that are external to the test or component.

10. Throughout the test run. unless you change the value of the variable programmatically in your script. the purpose of the parameter in the component. If you are defining an input parameter. in the format: Parameter("ParameterName"). enter a default value for the parameter in the Default Value column. regardless of the number of iterations.doc QTP Frame Work Adds a parameter to the appropriate parameter list. There are three types of environment variables: • User-Defined Internal—variables that you define within the test. You define test or component parameters in the same way you define action parameters. Removes the selected parameter from the test or component. QuickTest uses the default value for each defined input parameter if a specific value has not been defined for the parameter in either QuickTest or Quality Center. the value of an environment variable remains the same. These variables are saved with the test and are accessible only within the test in which they were defined. You can enter a description for the parameter. you insert them in your test or component by specifying the test or component parameter name with the Parameter reserved object. for example. Enter a name for the new parameter and select the parameter type. input parameter values for tests and components are taken from in the Input Parameters tab of the Run dialog box. user-defined environment variables for your test in the Environment tab of the Test Settings dialog box or in the Parameter Options dialog box. Confidential Page 63 of 100 . Defining Values for Input Parameters When the test or component runs. You can create or modify internal. When you run a test or business component from QuickTest.60761011.3 Environment Variables QuickTest can insert a value from the Environment variable list. Using Test or Component Parameters Once you have defined test or component parameters. which is a list of variables and corresponding values that can be accessed from your test.

The actual input and output action parameters that an action can receive or return. Note that external environment variable values are designated as read-only within the test. You can create as many files as you want and select an appropriate file for each test. Note: QuickTest also has a set of predefined environment variables that you can use to set the values of the Record and Run Settings dialog options. If you do not set a value for an input action parameter in the Action Call Properties dialog box. which retrieve values during the test run and output them to internal environment variable parameters for use in your test. are defined in the Action Properties dialog box. You use the Parameter Values tab of the Action Call Properties dialog box to specify the values of input action parameters used by the called action and to specify the locations in which you want to store output action parameter values.doc QTP Frame Work Tip: You can also create environment output values.60761011.4 Variable passing from one Action to another QuickTest enables you to retrieve values in your test or component and to store them as output values. You can also parameterize the value used for a particular input action parameter using any available parameter type. You can pass variables from one action to another by setting Action Call Parameter Values. or change files for each test run. and are designated as read-only. • User-Defined External—variables that you predefine in the active external environment variables file. These variables are accessible from all tests. and their types. You should not use the names of these variables for any other purpose. such as Test path and Operating system. Confidential Page 64 of 100 . You can subsequently retrieve these values and use them as input at a different stage in the run session. • Built-in—variables that represent information about the test and the computer on which the test is run. 10. the default value that is specified in the Action Properties dialog box is used.

60761011. click in the Store In box for the parameter and enter a variable name. which can be used in the called action. In the Output parameters area. To specify a location in which to store an output action parameter value: 1.doc QTP Frame Work You can specify a location in which to store the output action parameter values. Confidential Page 65 of 100 .

However.5 Scope of Variables Mainly there are two types of variables: action parameters and environment variables. An action's parameters are stored with the action and are the same for all calls to that action. 10. the actual values specified for input action parameters and the locations specified for action output parameters can be different for each call to the action.60761011. If you change the action parameters defined for an action. or an environment parameter. Repeat this procedure for each output action parameter value in the list. you can see the action parameters have changed. Alternatively.doc QTP Frame Work If we choose variable to store the value. the copy of the action is inserted with the action parameters and action call parameter values that were Confidential Page 66 of 100 . then the value is stored in a runtime variable for the duration of the run session. When you insert a call to a copy of an action. You can accept the default name assigned to the variable or enter a different variable name. 2. You can select to store the value in a test or action parameter. a Data Table parameter. you can click the output storage button in the Store In box to open the Storage Location Options dialog box in which you can specify a location for storing the output value. and then view the action properties for a call to that same action in a different part of the test.

Confidential Page 67 of 100 . Environment variables can be accessed from your test.doc QTP Frame Work defined for the action you copied. These variables are saved with the test and are accessible only within the test in which they were defined.  User-Defined External—variables that you predefine in the active external environment variables file. You can create or modify internal. You can create as many files as you want and select an appropriate file for each test.  Built-in—variables that represent information about the test and the computer on which the test is run. There are three types of environment variables:  User-Defined Internal—variables that you define within the test. and are designated as read-only. When you split an action. The action call values for the second action are taken from the default values of that action's parameters. the action parameters are copied to both actions. regardless of the number of iterations. Note that external environment variable values are designated as read-only within the test. or change files for each test run.60761011. Throughout the test run. the value of an environment variable remains the same. These variables are accessible from all tests. user-defined environment variables for your test in the Environment tab of the Test Settings dialog box or in the Parameter Options dialog box. unless you change the value of the variable programmatically in your script. such as Test path and Operating system.

we can check that the map zooms in correctly. Note: Bitmap checkpoints are supported for all add-in environments • Table Checkpoint checks information within a table. radio buttons. For example. Check Points A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. For example. For example. Note: Standard checkpoints are supported for all add-in environments • Image Checkpoint checks the value of an image in the application or Web page. Using the bitmap checkpoint. Confidential Page 68 of 100 . we can check that a selected image's source file is correct. suppose an application or Web site contains a table listing all available flights from New York to San Francisco. combo boxes.doc QTP Frame Work 11. The map has control keys for zooming. Note: Image checkpoint can be created by inserting a standard checkpoint on an image object.60761011. Image checkpoints are supported only for the Web environment • Bitmap Checkpoint checks an area of a Web page or an application as a bitmap. The standard checkpoint checks a variety of objects such as buttons.1 Types of Checkpoints In QTP the following types of checkpoints can be inserted to check various objects in a Web site or application. You can add a table checkpoint to check that the time of the first flight in the table is correct. We can record the new map that is displayed after one click on the control key that zooms in the map. you can check that a radio button is activated after it is selected or you can check the value of an edit field. etc. 11. • Standard Checkpoint checks the property value of an object in your application or Web page. For example. lists. consider a Web site that can display a map of a city the user specifies.

where <Num> is replaced by the four digit code entered in a form elsewhere in the application. guideline 1. For example. For example. and ActiveX add-in environments Text area checkpoints are also supported for some external add-in environments. you can check how long a Web page takes to load or whether a Web page contains broken links. For example. according to specified criteria. Text area checkpoints are supported for Standard Windows. suppose your Visual Basic application has a button that says View Doc <Num>. You can create a text area checkpoint to confirm that the number displayed on the button is the same as the number entered in the form.1 of the W3C Web Content Accessibility Guidelines requires you to provide a text equivalent for every non-text element. • Text Checkpoint checks that a text string is displayed in the appropriate place in the application or a Web page.60761011. Visual Basic. Note: You create a page checkpoint by inserting a standard checkpoint on a page object. For example. consider an application or Web page that displays the sentence Flight departing from New York to San Francisco.doc QTP Frame Work Note: You create a table checkpoint by inserting a standard checkpoint on a table object. Table checkpoints are supported for Web and ActiveX environments & for many other external add-in environments. We can create a text checkpoint that checks that the words "New York" are displayed between "Flight departing from" and "to San Francisco". do in fact have this tag. • Accessibility Checkpoint identifies areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. Accessibility checkpoints are supported for the Web environment • Page Checkpoint checks the characteristics of a Web page. You can add an Alt property check to check whether objects that require the Alt property under this guideline. Page checkpoints are supported for the Web environment Confidential Page 69 of 100 . Text checkpoints are supported for all add-in environments • Text Area Checkpoint checks that a text string is displayed within a defined area in a Windows application.

• XML Checkpoint checks the data content of XML documents in XML files or XML documents in Web pages and frames.60761011. For example. you can use a database checkpoint to check the contents of a database containing flight information for your Web site.2 Output Values for Verification The following are the categories of output values that can be created: • • • • • Standard Output Values Text Output Values Text Area Output Values Database Output Values XML Output Values For more information refer to Checkpoints Adding output values in a test in QTP Confidential Page 70 of 100 . • • To add checkpoints while recording To add a checkpoint while editing the test For more information refer to Checkpoints 11. XML checkpoints (Web page/frame) are supported for the Web environment.doc QTP Frame Work • Database Checkpoint checks the contents of a database accessed by your Web site. XML checkpoints (file) are supported by all environments For more specific information refer to Checkpoints Adding checkpoints in a test in QTP There are several ways to add checkpoints. Database checkpoints are supported by all environments.

Note: If you insert an output value on a Web page.60761011. These options are relevant only for checkpoints and are disabled when defining output values. This dialog except that it contains two additional option areas.doc • • QTP Frame Work To add checkpoints while recording To add a checkpoint while editing the test For more information refer to Checkpoints Output Values Properties Dialog Box The Output Value Properties dialog box enables you to choose which property values to output and to define the settings for each value that you select. the Page Output Value Properties dialog box opens. The output values can be output to either of these locations: • • Global\Local Sheet Environment variables Confidential Page 71 of 100 . HTML verification and All objects in page.

doc • Action\Test Parameter. QTP Frame Work This option is given in the output options dialog box 12.60761011. Reusable Library Description Confidential Page 72 of 100 .

To the test engineer. etc... We can also edit the list of associated library files for an existing test in the Test Settings dialog box. Changes to the default library files list in the Test. User defined We can specify the default library files for all new tests in the Test Settings dialog box (Test > Settings > Resources tab). a) Functions i. Starting with an introduction to software reuse and a discussion of its feasibility. reusable software components offer the same possibilities. Built-In ii. subroutine. Note that once a test is created. contained within any library file that is associated with our test.60761011. 12. making it essentially a small. the same components can be incorporated into many whole new systems. but invaluable. subroutines.1 Introduction In QTP we can create VBScript library files containing VBScript functions.doc QTP Frame Work When forming a new product the traditional engineer can take advantage of ready-made subassemblies. modules. and then associate the files with our test. classes. Any text file written in standard VBScript syntax can act as a library file. the list of files specified in the Test Settings dialog box is independent of the files set as default in the Test Settings dialog box. the authors go on to consider how the components that may be found could be used. etc. We can call any VBScript function. 12. thus saving the considerable time and effort it can take to generate new software.2 How to establish a Reusable Library a. The reusable library was designed with reuse very much in mind. library. Defining Resource Settings for Your Test Confidential Page 73 of 100 .

etc.doc QTP Frame Work We can use the Resources tab of the Test Settings dialog box to associate specific files with your test. We can also set the currently associated library files and object repository settings as the default settings for all new tests. b. To execute an externally-defined function: Confidential Page 74 of 100 . Executing Externally-Defined Functions from Your Test We can create a VBScript file and call its functions.. When we run our test.60761011. classes. the ExecuteFile statement executes all global code in the specified file in order to make all definitions in the file available from the global scope of the action's (or library file's) script. such as VBScript library files and Data Table files. and to specify the object repository mode and file to use for our test. from an action in your test or from an associated library file by inserting an ExecuteFile statement in our action or library file. subroutines.

Create a VBScript file using standard VBScript syntax. 12. 2.3 How to use this Reusable Library.60761011.1 Description Confidential Page 75 of 100 . from the specified VBScript file as necessary in your action or within other functions in an associated library file. classes.. 13.doc QTP Frame Work 1. subroutines. Add an ExecuteFile statement to an action in your test or in an associated library file using the following syntax: ExecuteFile FileName where FileName is the absolute or relative path of our VBScript file. Regular Expressions 13. 1. etc. 3. Store the file in any folder that you can access from the machine running your test. Use the functions.

A regular expression is a string that specifies a complex search phrase. A series of periods indicates the same number of unspecified characters. write: 196[789] 4. Matching Any Single Character in a List Square brackets instruct QuickTest to search for any single character within a list of characters.) instructs Quick Test to search for any single character (except for \n). Matching Any Single Character Not in a List Page 76 of 100 Confidential . Matching Any Single Character A period (. For example. or welcome followed by a space or any other single character. The most common expressions that can be used to create regular expressions are: 1. welcomed.mercuryinteractive. To match any single character including \n. or 1969. to search for the date 1967. Using the Backslash Character A backslash (\) instructs Quick Test to treat the next character as a literal character. enter: (.com 2. 1968. By using special characters we define the conditions of the search. matches welcomes. For example: welcome.60761011. you would write it as follows: mercurytours\. To increase the flexibility and adaptability of the tests we use regular expressions.doc QTP Frame Work While creating checkpoints we have an option only to search or check for a specific text string or a specific value of a property.|\n) 3. Regular Expressions enable Quick Test to identify objects and text strings with varying values. The backslash (\) can also instruct Quick Test to recognize certain ordinary characters as special characters. For example.com The period would be mistaken as an indication of a regular expression.mercuryinteractive\. To indicate that the period is not part of a regular expression. if it is otherwise a special character. consider a Web site called: mercurytours.

11. For example: ca?r matches car and cr. For example: foo|bar causes QuickTest to match either foo or bar. 9. Matching Zero or More Specific Characters An asterisk (*) instructs QuickTest to match zero or more occurrences of the preceding character. and cr. [-a-z] matches a hyphen or any lowercase letter. Grouping Regular Expressions Parentheses (()) instruct Quick Test to treat the contained sequence as a unit. you can use square brackets ([ ]) with the hyphen (-) character. 8. but nothing else. Using groups is especially useful for delimiting the argument(s) to an alternation operator ( | ) or a repetition operator ( * . ? . or after a caret (^). write: 196[0-9] A hyphen does not signify a range if it is displayed as the first or last character within brackets. For instance. it instructs QuickTest to match any character in the list except for the ones specified in the string. For example: ca+r matches car and caaaaaar. { } ). Matching the Beginning of a Line Confidential Page 77 of 100 . fo(o|b)ar causes Quick Test to match either fooar or fobar. For example: [^ab] matches any character except a or b. 6. Matching Zero or One Specific Character A question mark (?) instructs Quick Test to match zero or one occurrences of the preceding character. just as in mathematics and programming languages. caaaaaar.60761011. + . For example. 7. Matching Any Single Character within a Range In order to match a single character within a range. 10. 5. Matching One of Several Regular Expressions A vertical line (|) instructs QuickTest to match one of a choice of expressions. Matching One or More Specific Characters A plus sign (+) instructs QuickTest to match one or more occurrences of the preceding character. but not cr.doc QTP Frame Work When a caret (^) is the first character inside square brackets. For example: ca*r matches car. to match any year in the 1960s.

* matches start. or 12_uYLgeu_435. For example: book$ Matches book only in the line—my book. 13. a-z. and # . It matches Ab4. while ^book Matches book only in the lines—book and book list 12. started. $. starting. you can combine the `. r9Cj.60761011. starter.' and `*' characters in order to find zero or more occurrences of any character (except \n). It matches Ab. You can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. Combining Regular Expression Operators You can combine regular expression operators in a single expression to achieve the exact search criteria you need. start. or before a new line character. and book list. 0-9. %. 0-9. ^. For example. 15.Matching Any AlphaNumeric Character Including the Underscore \w instructs QuickTest to match any alphanumeric character and the underscore (A-Z. For example: [a-zA-Z]* Creating checkpoints with Regular Expressions Confidential Page 78 of 100 . or after a newline character. Matching Any Non-AlphaNumeric Character \W instructs QuickTest to match any character other than alphanumeric characters and underscores. while a string that is followed by ($). or z_M. For example: \w{3} causes Quick Test to match 3 occurrences of the alphanumeric characters AZ. For example: \W matches &. and book list. For example: book matches book within the lines—book. For example: \w* causes QuickTest to match zero or more occurrences of the alphanumeric characters—A-Z. matches only lines ending in that string. _). etc. Matching the End of a Line A dollar sign ($) instructs Quick Test to match the expression only at the end of a line.doc QTP Frame Work A caret (^) instructs QuickTest to match the expression only at the start of a line. a-z. a-z. For example. and the underscore (_). For example: book Matches book within the lines—my book. *. my book. 14. r9_. 0-9. and the underscore (_).

doc QTP Frame Work Regular expressions are generally used in the context of creating checkpoints to check a range of values. [0-9][0-9]".60761011. the Test Results window opens. For more information on creating checkpoints with regular expressions refer Regular Expressions Analyzing a Test with Regular Expressions When the test run is completed. Confidential Page 79 of 100 . expand (+) Test RegExpression Summary > RegExpression Iteration 1 (Row 1) > Action1 Summary > Flight Reservations > Fax Order No. 1. The checkpoint passed because the text was displayed in the format specified by the regular expression. 12 Select CheckPoint "Fax Order No\. In the results tree. Examine the checkpoint results.

For example. Unexpected events. Recovery Scenario You can instruct Quick Test to recover from unexpected events and errors that occur in your testing environment during a test run. grouped according to your own specific requirements. Recovery scenarios are saved in recovery scenario files.doc QTP Frame Work 14. and from which point in the test Quick Test should continue. For example. you must first associate it with that test. if at all. A recovery scenario consists of the following:  Trigger Event—The event that interrupts your test run.60761011. you may want to restart a test from the beginning. and application crashes during a test run can disrupt your test and distort test results.  Recovery Operation(s)—The operation(s) that need to be performed in order to continue running the test. or restarting Microsoft Windows. Confidential Page 80 of 100 . The Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario—a definition of an unexpected event and the operation(s) necessary to recover the test run. A test can have any number of recovery scenarios associated with it. clicking an OK button in a pop-up window. This is a problem particularly when running tests unattended—the test is suspended until you perform the action needed to recover. For example. To instruct Quick Test to perform a recovery scenario during a test run. or a Quick Test test run error. a window that may pop up on screen. You can prioritize the scenarios associated with your test to ensure that trigger events are recognized and handled in the required order. you can instruct Quick Test to detect a Printer out of paper message and recover the test run by clicking the OK button to close the message and continue the test. For example. A recovery scenario file is a logical collection of recovery scenarios.  Post-Recovery Test Run Option—The instructions on how Quick Test should proceed once the recovery operations have been performed. or skip a test step entirely and continue with the next step in the test. errors.

If a trigger event has occurred. 14. the recovery file and its scenarios are saved. If you are using a new recovery file. 2. You create recovery scenarios using the Recovery Scenario Wizard.1 Exceptional Handling using Recovery Scenarios The Recovery Scenario Manager dialog box enables you to create recovery scenarios and save them in recovery files. Quick Test performs the corresponding recovery and post-recovery operations. If you chose this option and need to recover from an unexpected event or error that may occur in the last step. If you added or modified scenarios in an existing recovery file. Creating a Recovery File You save your recovery scenarios in a recovery file. For more information on creating a Recovery File refer to Creating a Recovery File Saving the Recovery Scenario in a Recovery File After you create or modify a recovery scenario in a recovery file using the Recovery Scenario Wizard.doc QTP Frame Work When you run a test for which you have defined recovery scenarios and an error occurs. Choose the folder in which you want to save the file. you need to save the recovery file. the recovery mechanism does not handle triggers that occur in the last step of a test.60761011. which leads you through the process of defining each of the stages of the recovery scenario. the Save Attachment dialog box opens. You then save the recovery scenarios in a recovery file. Quick Test looks for the defined trigger event(s) that caused the error. To save a new or modified recovery file: 1. Note: If you choose On error in the Activate recovery scenarios box in the Recovery tab of the Test Settings dialog box. You can also control and activate your recovery scenarios during the test run by inserting Recovery statements into your test. you of a test can do this by adding an extra step to the end of your test. Click the Save button . Confidential Page 81 of 100 . and associate them with a specific test or tests. You can create a new recovery file or edit an existing one. Tip: You can also click the arrow to the right of the Save button and select Save As to save the recovery file under a different name. A recovery file is a convenient way to organize and store multiple recovery scenarios together.

and proceed with step 2 above. Quick Test prompts you to save the recovery file. you can use the Recovery Scenario Manager to manage them. Tip: If you have not yet saved the recovery file. Type a name for the file in the File name box. and you click Yes to the message prompt. the recovery file and its scenarios are saved. Managing Recovery Scenarios Once you have created recovery scenarios. The recovery file is saved in the specified location with the file extension .doc QTP Frame Work 3. Indicates that the recovery scenario is triggered when the property values Confidential Page 82 of 100 . Click Yes.60761011.qrs. If you added or modified scenarios in an existing recovery file. The Recovery Scenario Manager contains the following recovery scenario icons: Icon Description Indicates that the recovery scenario is triggered when a window pops up in an open application during the test run. and you click the Close button in the Recovery Scenario Manager dialog box.

doc QTP Frame Work of an object in an application match specified values. The Recovery Scenario Properties dialog box displays the following read-only information about the selected scenario: Confidential Page 83 of 100 .60761011. you can double-click a scenario in the Scenarios box. select the recovery scenario whose properties you want to view. The Recovery Scenario Properties dialog box opens. Indicates that the recovery scenario is triggered when a step in the test does not run successfully. To view recovery scenario properties: 1 In the Scenarios box. Indicates that the recovery scenario is triggered when an open application fails during the test run. 2 Click the Properties button . The Recovery Scenario Manager enables you to manage existing scenarios by:  Viewing Recovery Scenario Properties  Modifying Recovery Scenarios  Deleting Recovery Scenarios  Copying Recovery Scenarios between Recovery Scenario Files Viewing Recovery Scenario Properties You can view properties for any defined recovery scenario. Alternatively.

2 Click the Edit button . with the settings you defined for the selected recovery scenario. 3 Navigate through the Recovery Scenario Wizard and modify the details as needed. select the recovery scenario that you want to copy. 2 Click the Delete button .  Post-Recovery Operation tab—Displays the post-recovery operation defined for the recovery scenario. 2 Click the Copy button . To modify a recovery scenario: 1 In the Scenarios box. select the scenario that you want to modify. Deleting Recovery Scenarios You can delete an existing recovery scenario if you no longer need it. the corresponding information is deleted from the recovery scenario file. Note: If a deleted recovery scenario is associated with a test. Modifying Recovery Scenarios You can modify the settings for an existing recovery scenario.  Trigger Event tab—Displays the settings for the trigger event defined for the recovery scenario. To copy a recovery scenario from one recovery scenario file to another: 1 In the Scenarios box. Quick Test ignores it during the test run.  Recovery operation tab—Displays the recovery operation(s) defined for the recovery scenario. select the scenario that you want to delete.60761011. The scenario is copied to the Clipboard. The Recovery Scenario Wizard opens.doc QTP Frame Work  General tab—Displays the name and description defined for the recovery scenario. When you delete a recovery scenario from the Recovery Scenario Manager. To delete a recovery scenario: 1 In the Scenarios box. plus the name and path of the recovery file in which the scenario is saved. The recovery scenario is deleted. Page 84 of 100 Confidential . Copying Recovery Scenarios between Recovery Scenario Files You can copy recovery scenarios from one recovery scenario file to another.

Quick Test checks for applicable recovery Confidential Page 85 of 100 . The Recovery Scenario Properties dialog box opens. or click the New button file in which to copy the scenario. Adding Recovery Scenarios to Your Test After you have created recovery scenarios. that are associated with a test. To view recovery scenario properties: 1 In the Scenarios box. When a trigger event occurs. Alternatively. Setting the Recovery Scenarios List for Your Tests After you have created recovery scenarios.60761011. The scenario is copied to the new recovery scenario file. Quick Test checks for applicable recovery scenarios in the order in which they are displayed in the Recovery tab. select the recovery scenario whose properties you want to view. You can also define which recovery scenarios will be used as the default scenarios for all new tests. You can change this order as described in “Setting Recovery Scenario Priorities” For more information on “adding a recovery scenario to a test” refer to Adding Recovery Scenario to a Test Viewing Recovery Scenario Properties You can view properties for any recovery scenario associated with your test. The Recovery tab of the Test Settings dialog box lists all the recovery scenarios associated with the current test. you can associate one or more scenarios with a test in order to instruct Quick Test to perform the recovery scenario(s) during the test run if a trigger event occurs. Setting Recovery Scenario Priorities You can specify the order in which Quick Test performs associated scenarios during a test run. you can double-click a scenario in the Scenarios box. You can prioritize the scenarios and set the order in which Quick Test applies the scenarios during the test run. Note: If a scenario with the same name already exists in the recovery scenario file. 4 Click the Paste button .doc 3 Click the Open button QTP Frame Work and select the recovery scenario file to which you want to create a new recovery scenario to copy the scenario. displaying read-only information regarding the settings for the selected scenario. you can choose whether you want to replace it with the new scenario you have just copied. you associate them with selected tests so that Quick Test will perform the appropriate scenario(s) during the test runs if a trigger event occurs. You can also choose to disable specific scenarios. Tip: When a trigger event occurs. or all scenarios. 2 Click the Properties button .

select the scenario whose priority you want to change. a step that selects a check box may cause a pop-up dialog box to open. but Quick Test will no longer perform the scenario during a test run. When you disable a specific scenario. To define when the recovery mechanism is activated: Select one of the following options in the Activate recovery scenarios box:  Always—The recovery mechanism is activated after every step. 2 Click the Remove button . 2 Click the Up or Down button .doc QTP Frame Work scenarios in the order in which they are displayed in the Recovery tab of the Test Settings dialog box. The selected scenario is no longer associated with the test. Note that the step that returns an error is often not the same as the step that causes the exception event to occur. For example. Although the pop-up dialog box is defined as a trigger event. Enabling and Disabling Recovery Scenarios You can enable or disable specific scenarios and determine when Quick Test activates the recovery scenario mechanism in the Recovery tab of the Test Settings dialog box.  Clear the check box to the left of one or more individual scenarios to disable them. 3 Repeat steps 1-2 for each scenario whose priority you want to change. To set recovery scenario priorities: 1 In the Scenarios box. Quick Test moves to the next step because it successfully performed the check box selection Confidential Page 86 of 100 .  On error—The recovery mechanism is activated only after steps that return an error return value. the scenario itself still exists.60761011. To enable/disable specific recovery scenarios:  Select the check box to the left of one or more individual scenarios to enable them. To remove a recovery scenario from your test: 1 In the Scenarios box. select the scenario you want to remove. After you remove a scenario from a test. but is not performed by Quick Test during the test run. it remains associated with the test. You can enable the scenario at a later time. Removing Recovery Scenarios from Your Test You can remove the association between a specific scenario and a test using the Recovery tab of the Test Settings dialog box. The selected scenario’s priority changes according to your selection.

Confidential Page 87 of 100 . it is this tenth step that returns an error and triggers the recovery mechanism to close the dialog box. In Flight Application. In this case. Setting Default Recovery Scenario Settings for All New Tests You can click the Set as Default button in the Recovery tab of the Test Settings dialog box to set the current list of recovery scenarios to be the default scenarios for all new tests. 14. Any future changes you make to the current recovery scenario list only affect the current test.  Never—The recovery mechanism is disabled. and do not change the default list that you defined. The next several steps could potentially perform checkpoints. when we give wrong password in the login dialog box then we get the following popup window: In order to handle this.2 Sample for Recovery Scenario: For adding a recovery Scenario: Let us take an example of a popup window exception. After the recovery operation is completed. the current step is this tenth step.doc QTP Frame Work step. in the “Select Trigger Event” screen of Recovery Scenario Wizard. It may only be ten statements later that a step instructs Quick Test to perform an operation on the application that it cannot perform due to the pop-up dialog box. and not the step that caused the trigger event.60761011. take a new recovery scenario. functions or other conditional or looping statements that do not require performing operations on your application. select “pop-up window” Radio button as shown below.

by spying the popup window.doc QTP Frame Work In the next screen.60761011. we can specify Pop-up window condition. then details of the pop-up window appears as follows: Confidential Page 88 of 100 .

doc QTP Frame Work then in the next step.60761011. then in the next step select “Press ENTER Key” radio button. In the recovery operation screen select “keyboard or mouse operation” radio button. In the next screen select “Add another recovery operation” check box as given below: Confidential Page 89 of 100 .

In the “Post-Recovery Test Run Options” screen select “Repeat current step and Continue” radio button. thus the recovery will be created.doc QTP Frame Work then in the next step. give a name to the recovery scenario. Adding a Recovery scenario into the Test: We can add the Recovery Scenario to our test in two ways. We can add the Recovery Scenario to our test while we create a new Recovery Scenario by checking the “add Scenario to current test” check box in “Completing the Recovery Scenario Wizard” screen of Recovery Scenario Wizard. 1.60761011. Confidential Page 90 of 100 . In the recovery operation screen select “function call” radio button Specify the path and name of the library file which has the appropriate function for entering the password and clicking “ok” button of “Login” dialog box.

60761011. The other way to add Recovery Scenario to our test is by adding the required scenario file in the recovery tab of Test Settings Dialog box. Confidential Page 91 of 100 .doc QTP Frame Work 2.

60761011.doc QTP Frame Work Confidential Page 92 of 100 .

QuickTest does not necessarily abort the test run.60761011. QuickTest automatically marks as optional steps that open certain dialog boxes. Default Optional Steps: There are some default objects. It bypasses any step designated "optional" and continues running the test.doc QTP Frame Work 15. You can manually designate additional steps as optional. so that it proceeds to the next step. By default. for those objects QTP by default sets as optional.1 Description: When running a test. those objects are as follows: Dialog boxes with title bar as Auto Complete File Download Internet Explorer Netscape Enter Network Password Error Security Alert Security Information Security Warning Username and Password Required Confidential Page 93 of 100 . which QTP recognizes as optional. If a dialog box may or may not appear at a particular instanse then that dialog box actions performed can be set as optional. Optional Steps 15. if a step does not succeed in opening a dialog box. if the screen or dialog box doesn’t appear or will continue the normal flow.

The Optional Step icon will be added next to the selected step. We can directly Right-click a step in the Keyword View and choose Optional Step. Example: OptionalStep.60761011. 2.Browser("browser_name").Page("page_n ame").Link("link_name") Confidential Page 94 of 100 . You can also add an optional step from the Expert View by adding OptionalStep to the beginning of the VBScript statement.doc QTP Frame Work Setting Optional Steps: There are two ways of setting Optional steps: 1.

• • Confidential Page 95 of 100 . choose Start > Programs > QuickTest Professional > Test Results Viewer.doc QTP Frame Work 16. The Test Results window contains the following key elements: Menu bar—Displays menus of available commands. Test Results Window After a test run. Test results toolbar—Contains buttons for viewing test results (choose View > Test Results Toolbar to display the toolbar). the Test Results window opens when a test run is completed. and add the appropriate comments and reports to the test results to increase the readability of it. Reporting The process of reporting is to customize the test results. Reporting can be done in various formats. we view the results in the Test Results window. To open the Test Results window. Note: You can open the Test Results window as a standalone application from the Start menu. By default.60761011.

• Never Note: If “Always” option is selected then the result file will occupy lots of memory. • On Errors – adds screen shots only on occurrence of error • On Errors and Warnings – adds on both errors and warnings. thus selection of “Always” option should be done only if the client wants to view all the screen shots for reference during review.1 Different Options for Reporting There are 3 options for screen capture the screens to the results: • Always – adds screen shots to the results for every step. • Test results details—Contains details of the selected step. • Active Screen—Shows the active screen of the particular window or step in the results. Confidential Page 96 of 100 . 16.doc • QTP Frame Work Test results tree—Contains a graphic representation of the test results in the test results tree.60761011.

but does not cause the test to stop running. the test fails. Not in use. EventStatus Number or pre-defined constant ReportStepName String Details in Example String N/A The following example uses the Report Event method to report that the checkpoint on this window has passed. You can use this method to completely disable or enable reporting of steps following the statement. in] Argument Type Description Status of the report step: 0 or micPass: Causes the status of this step to be passed and sends the specified message to the report."Fax Order No. 3 or micWarning: Sends a warning message to the report.ReportEvent EventStatus. 1 or micFail: Causes the status of this step to be failed and sends the specified message to the report. When this step runs. Reporter. ReportEvent Method Reports an event to the Test Reports.ReportEvent 0. Filter Property Retrieves or sets the current mode for displaying events in the Test Results. Description of the report event. or Confidential Page 97 of 100 . 4 or micInfo: Applies an information status (and icon) to the step.60761011. Name of the intended step in the report (object name). and does not affect the pass/fail status of the test. Details [. The string will be displayed in the step details frame in the test report .2 Functions used for Reporting 1. 12".doc QTP Frame Work 16. This status does not affect the pass/fail status of the test."The check point for this window has passed " 2. Syntax: Reporter. 2 or micDone: Sends a message to the report without affecting the pass/fail status of the test. ReportStepName.

All reported events are displayed in the Test Results.ReportEvent micGeneral.ReportEvent micGeneral. Confidential Page 98 of 100 .60761011. 2. "" Reporter.Filter To set the mode: Reporter. "3". Only events with a fail status are displayed in the Test Results.doc QTP Frame Work you can indicate that you only want subsequent failed or failed and warning steps to be included in the report.Filter = NewMode The mode can be one of the following values: Mode 0 or rfEnableAll 1 or rfEnableErrorsAndWarnings 2 or rfEnableErrorsOnly 3 or rfDisableAll Description Default. "6".ReportEvent micGeneral. "" Reporter.ReportEvent micGeneral. "" Reporter. "1". Example The following example uses the Filter method to report the following events in the Test Results: 1. and 6. "5". "" Reporter. No events are displayed in the Test Results.Filter = rfDisableAll Reporter. "" Reporter. Only event with a warning or fail status are displayed in the Test Results. ReportPath Property Retrieves the folder path in which the current test's Test Results are stored. "2". " 3.Filter = rfEnableAll Reporter. Reporter. "4". 5.ReportEvent micGeneral.ReportEvent micGeneral. Syntax: To retrieve the mode setting: CurrentMode = Reporter.

This is useful in transfer of the results information across platforms.ReportPath Argument Type Path Example QTP Frame Work Description String The folder path in which the current test's Test Results are stored.3 Reporting Formats The results of the QTP runs are stored in the Results folder. which must be specified before starting the test run. dim Path Path = Reporter. The following example uses the ReportPath method to retrieve the folder in which the test's Test Results are stored and displays the folder in a message box.ReportPath MsgBox (Path) 16. opens with QTP • XML format – the results are also stored in XML file.doc Syntax Path = Reporter. The results are stored in 2 types of formats: • QTP format – this is the format in which the results are displayed in the test window. in which all the objects are stored in a hierarchy in .xml format. Confidential Page 99 of 100 . since it is based on simple Unicode format.60761011.

60761011.doc QTP Frame Work Fig: results in XML format Confidential Page 100 of 100 .

Sign up to vote on this title
UsefulNot useful