SlideShare a Scribd company logo
1 of 100
For more QTP scripts, Log onto www.ramupalanki.com




                        QTP
                      Frame Work




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


                                           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................................................................54
  9.1 Per Action/Shared Object Repository:.....................................................................54
  9.2 Merging of two object repositories:.........................................................................56
  9.3 Limitations:..............................................................................................................57
10. Variables...........................................................................59
  10.1 Action Parameters................................................................................................59

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
 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




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




1.2   Approach for Test Automation


Description




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
Approach for Test Automation is used for building a strategy for automation starting
from the Requirement phase till the deployment phase. Approach for automation begins
with finding out the conditions and business rules given by the client and grouping
similar conditions, business rules together as Test cases or Test Scenarios.

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, Team was divided into two,
SAP Consultants.
Testing Team.

Requirement gathering from the client included knowledge transfer at onsite, where all
the transactions including the customized transactions where explained to the SAP
Consultants of satyam, Under standing of requirements was done at the client side,
Depending on the flow of transactions, all the transactions where grouped together as
different scenarios. While SAP Consultants where onsite for gathering Requirements,
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, user accounts for SAP access, Installation of QTP
and SAP.

All the Identified Scenarios which consists of different transactions where explained to
Testing Team. Then common functionalities where identified, and grouped together as
different Test cases.

After defining different Test cases, design for automation of scripts was done, where
Reusability was one of the main aspects, where all the transactions, which are common in
the scenarios, are identified as Reusable transactions.



Automation Framework:

For Quality deliverables, important things that should be followed are:

   •   Following common coding structure for all the scripts

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
   •   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, This Action intern will call all the other actions (Each
Transaction used in the script would be an action) in the script. Importing and
Exporting of sheets is also done in this main action. Importing of sheets is done at the
beginning before calling other actions and exporting of sheets is done at the last. Sheets
corresponding to all the actions in the scripts are imported, so that the data in the fields of
the Imported sheets are used as input data to the script, output data from the script is also
collected and exported to the corresponding sheet.

There are many transactions which are reused in the scripts, similar transactions
(Actions) are made as reusable so that its not required to record those transactions again
and again, which ever transaction was common among scripts, were recorded in one
script and is reused in all the scripts where the transaction is required.

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. Major types of Recovery used in this
project where Popup Window, Object state and on Error Recoveries. In Error
handling using Recovery, all the common types of exceptions or errors are given
common Recovery scenarios using regular expressions, which minimized the number of
Recovery scenarios and Functions used.




Design for Structure of Scripts used in Unilever Project:



Main Action, which calls all the other                                     Called Actions

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
    Actions (transactions) in the script
                                                              <Action Name>


Main Action                     Calls
in the Script                                                 <Action Name>




    Ex: S014_001 (Action Name) Ex: ME21N (Action Name
                                       Which is same as the
                                       Transaction name in
                                       SAP)




    www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
Design of the Approach for Test Automation is given below




                            Identification of Test Cases for Automation




                            Identification of Common Functionality




                         Coding Standards, Naming Conventions & Templates




                                   Building the Re-Usable Library




                                 Tool & Application          General library
    Application Login,           Settings, Restoring,        containing String          Error handling, Log
    Logout, Common               Object Repository,          handling, Date handling,   Reporting,
    Functionality
                                 Recovery, House             File Handling, Data        messaging etc
    Related code etc
                                 Keeping etc                 Table handling




                                  Script Development using Record & Play back




                                 Deliver the script after Verification & Validation




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
Design for Automation of Test cases for Unilever Foods:

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, Creating a Transfer Requirement and a Transfer Order.



                       Actions for the Transactions Login, LB01,
                       MM03, LT04, LT012 and Logoff.



                       Common Functions are LT12, MM03



            Coding Standards & Naming Conventions like ‘The file name as per
            convention - Scenario name’, ‘The Action named as per transaction ID’



                       Building the Re-Usable Library like ‘The
                       common functionality being reused’




             Application              Recoveries are                Error handling like On
            Login, Logout             gAlready_exist.qrs            Error Resume Next,
            and common                S014_164_Materia              Reporting like
            functions like            l_Not_Maintained.             reporter.ReportEvent
            LT12, MM03                qrs                           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.

QTP Framework in SAP Automation


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




                                                                                      Test Results
              Test Data              SAP                      Script for
                                                                                       Reporting
              Handling and           Application              Business
                                                                                          and
              Data Sheet             Session                  Transaction/
                                                                                      Application
              Importing              Login                    Test Case
                                                                                       Closing.


          Re-Usable Library:
          Generic Library calls for handling data, date, 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.

          •    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.g. creating customer records, Invoicing and
               other high volume activities where software failure would occur frequently
               have been considered.


          •    Mission critical processes like core activities like sales order processing
               are prime candidates for automated testing and have been considered for
               automation.


          •     Repetitive Testing

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
        •   Applications with Long Life span – Longer the application in production
            greater the benefits from automation.

        •   Avoiding dynamic screens. Though possible to automate this increases the
            complexity of the script.

        •   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. If the numbers of rows were very high the
            execution time of the script would be high. This leads to performance
            issues of the recorded script. Hence, it is better to prove the business
            scenario wherein tables with row selections figure by identifying a fixed
            row number. 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 scenarios that require high degree of coding while automating so
            that script’s complexity is reduced and high maintainability of the script is
            ensured.




                   2.        Introduction to QTP

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
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:


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
- Oracle
- Microsoft
- IBM
- BEA
- ODBC
- COM / COM+

Multimedia:

- Flash
- RealAudio / RealVideo
- Windows Media Player


Operating Environment

Operating Systems         Windows XP/2000/NT
Supported:                Windows 95/98/ME

Databases Supported:  (Not Applicable)
Networks Supported:   TCP/IP
Programming           JavaScript
Languages Supported:  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 :

                               IBM-PC or compatible with a Pentium® II 266 MHz
        Computer/Processor:
                               microprocessor (366 MHz recommended).
                               Windows® 98 Second Edition, Windows® 2000—
                               Service Pack 3,
        Operating System:
                               Windows NT® 4.0—Service Pack 6a,
                               Windows® Me, or Windows® XP—Service Pack 1.


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

      Memory:                    128 MB of RAM (256 MB recommended)
      Free Hard Disk             150 MB of free disk space for a compact installation or
      Space:                     200 MB for a typical or complete installation
                                 Microsoft Internet Explorer 5.0–6.0.
      Browser:


       Supported Environments
       QuickTest Professional supports creating, recording, and running tests in the
       environments described below.

           Standard Windows Applications

                1. Win32 API

                2. 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:




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

      Name                                 ProgId
      FarPoint Spreadsheet 2.5             FPSpread.Spread.1
      FarPoint Spreadsheet 3.0             FPSpread.Spread.2
      FarPoint Spreadsheet 3.5             FPSpread.Spread.3
      FarPoint Spreadsheet 6.0             FPSpread.Spread.4
      FarPoint Spreadsheet 3.0 (OLEDB) FPSpreadADO.fpSpread.2
      FarPoint Spreadsheet 3.5 (OLEDB) FPSpreadADO.fpSpread.3
      FarPoint Spreadsheet 6 (OLEDB)       FPSpreadADO.fpSpread.4
      Microsoft Grid 1.0                   MSGrid.Grid
      Microsoft DataBound Grid 5.0         MSDBGrid.DBGrid
      Microsoft Flex Grid 6.0              MSFlexGridLib.MSFlexGrid.1
      Sheridan Data Grid 2.0               SSDataWidgets.SSDBGridCtrlApt.1
      Sheridan Data Grid 3.1               SSDataWidgets.SSDBGridCtrlApt.3
      Apex True DataBound Grid 5.0         TrueDBGrid50.TDBGrid
      Apex True DataBound Grid 6.0         TrueDBGrid60.TDBGrid
      Apex True OLE DB Grid 6.0            TrueOleDBGrid60.TDBGrid




       ActiveX Calendar Controls

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

      Name                                               ProgId
      Microsoft Date and Time Picker Control 6.0 (SP4) MSComCtl2.DTPicker.2
      Microsoft MonthView Control 6.0 (SP4)              MSComCtl2.MonthView.2




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
        Multimedia Applications

        QTP6.5 supports testing on the following multimedia applications:

    •   Microsoft Windows MediaPlayer controls, version 6.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. You can also test Macromedia Flash 6 clips containing only
        Flash 4 or 5 commands.

        Additional Environments

        QuickTest Professional add-ins support other environments such as
        Java, .NET Windows and Web Forms, SAP solutions, Oracle, Siebel,
        PeopleSoft, Web Services, and terminal emulator applications. For more
        information about QuickTest Professional add-ins, contact your sales
        representative or Mercury Interactive Customer Support.

        Note for QuickTest Professional 6.0 and earlier:
        Java support and Oracle support are now available as separate add-ins to
        QuickTest Professional 6.5 and are no longer part of the core product.




QTP 8.0:
www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

System Requirements

        To successfully install and run QTP8.0, you need the following
        minimum system requirements:

                                IBM-PC or compatible with a Pentium II 266 MHz
        Computer/Processor:
                                microprocessor (366 MHz recommended).
                                Windows 2000-Service Pack 3 or Service Pack 4,
        Operating System:
                                Windows XP-Service Pack 1, or Windows 2003 Server.
        Memory:                 128 MB of RAM (256 MB recommended).
                                250 MB of free disk space for application files and
                                folders, and an additional 120 MB of free disk space on
                                the system disk (the disk on which the operating system
        Free Hard Disk          is installed).
        Space:                  After Quick Test Professional is installed, 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.
                                Microsoft Internet Explorer 5.5 Service Pack 2-6.0.
        Browser:




Supported Add-ins

        The following external QuickTest 6.5.x add-ins are supported for use
        with QuickTest Professional 8.0:

    •   Java Add-in 6.5
    •   Oracle Add-in 6.5
    •   PeopleSoft Add-in 6.5
    •   Terminal Emulator Add-in 6.5
    •   .NET Add-in 6.5.1
    •   SAP solutions Add-in 6.5.1




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
       Note: Siebel Add-in 6.5, the .NET Add-in 6.5, the Add-in for SAP
       solutions 6.5, or any 6.0 add-ins,cannot be used with QuickTest
       Professional 8.0.1

Supported Environments and Programs

       QuickTest Professional 8.0 supports creating, recording, and running
       tests or components using the environments and programs described
       below.

           Standard Windows Applications

             1.Win32 API

             2.MFC

           Visual Basic Applications

             Visual Basic 6.0

       Note: Visual Basic .NET applications are supported by the QuickTest
       Professional .NET Add-in.

           Browsers
                •   Microsoft Internet Explorer 5.5 Service Pack 2-6.0
                    (required)
                •   Netscape 6.1, Netscape 6.22, Netscape 6.23, Netscape 7.02,
                    and Netscape 7.1 (optional)
                •   AOL 8.0 and 9.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:




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

      Name                                  ProgId
      FarPoint Spreadsheet 2.5              FPSpread.Spread.1
      FarPoint Spreadsheet 3.0              FPSpread.Spread.2
      FarPoint Spreadsheet 3.5              FPSpread.Spread.3
      FarPoint Spreadsheet 6.0              FPSpread.Spread.4
      FarPoint Spreadsheet 3.0 (OLEDB) FPSpreadADO.fpSpread.2
      FarPoint Spreadsheet 3.5 (OLEDB) FPSpreadADO.fpSpread.3
      FarPoint Spreadsheet 6 (OLEDB)        FPSpreadADO.fpSpread.4
      Microsoft Grid 1.0                    MSGrid.Grid
      Microsoft DataBound Grid 5.0          MSDBGrid.DBGrid
      Microsoft Flex Grid 6.0               MSFlexGridLib.MSFlexGrid.1
      Sheridan Data Grid 2.0                SSDataWidgets.SSDBGridCtrlApt.1
      Sheridan Data Grid 3.1                SSDataWidgets.SSDBGridCtrlApt.3
      Apex True DataBound Grid 5.0          TrueDBGrid50.TDBGrid
      Apex True DataBound Grid 6.0          TrueDBGrid60.TDBGrid
      Apex True OLE DB Grid 6.0             TrueOleDBGrid60.TDBGrid



ActiveX Calendar Controls

       In addition to built-in support for ActiveX properties and methods,
       QuickTest Professional supports context-sensitive recording and
       verification on the following ActiveX Calendar controls:

      Name                                                 ProgId
      Microsoft Date and Time Picker Control 6.0 (SP4) MSComCtl2.DTPicker.2
      Microsoft MonthView Control 6.0 (SP4)                MSComCtl2.MonthView.2




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
Microsoft Excel

       When using Microsoft Excel files with QuickTest Professional 8.0(for
       example, to import or export data to or from the Data Table), you can
       work with Microsoft Excel 2000, 2002, 2003, and XP.



       Microsoft Query

       When using Microsoft Query with QuickTest Professional 8.0 (for
       example, for Database checkpoints), you can work with Microsoft
       Query 2000, 2002, 2003, and XP.



       Additional Environments

       QuickTest Professional add-ins support other environments such as
       Java, .NET Windows and Web Forms, SAP Solutions, Oracle, Siebel,
       PeopleSoft, Web Services, and terminal emulator applications. For more
       information on QuickTest Professional add-ins, contact your sales
       representative or Mercury Interactive Customer Support.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                                    3.      Add-Ins

3.1       Types of Add-Ins


               QTP version                                               Add-ins
                                                     Java add-in 6.5
                   8.2                               Oracle add-in 6.5

                                                     Siebel add-in 8.0
                                                     Terminal Emulator add-in 8.0
                                                     . Net add-in 8.2

                                                    Default Add-Ins: Active X Controls,
                                                    Web &Visual Basic

                                                      . Net add-in 6.5.1
                  8.0                                 Sap add-in 6.5.1
                                                      Java add-in 6.5
                                                      PeopleSoft add-in 6.5
                                                      Oracle add-in 6.5
                                                      Terminal Emulator add-in 6.5

                                                    Default Add-Ins: Active X Controls,
                                                    Web &Visual Basic

                 6.5                                . Net
                                                     Web
                                                     Java
                                                     XML
                                                    Default Add-Ins: Active X controls,
                                                    Multimedia, Visual Basic, Web



Note: Quick Test Professional Siebel add-in 6.5 and Web services add-in 6.0 cannot be
used with Quick Test 8.0.

      •   The add-ins for Quick Test Professional 6.0 cannot be used with Quick Test
          Professional 6.5. If you are using Quick Test Professional 6.5, you will need to
          get the 6.5 version of your add-in.


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


3.2     Conditions for Add-ins


3.2.1   Java Add-In

When testing Java applets in a Web browser, you must load the Web add-in as well as the
Java Add-in, and use the Web tab of the Record and Run Settings
Dialog box to specify your record and run preferences. To test Java applets or
applications running on Netscape 4.x’s built-in JVM (not Java Plug-ins), confirm that the
Netscape 4.x browser is already installed before installing the Quick Test Professional
Java Add-in. When testing Java applets in a Web browser web Add-in as well as java
add-in must be loaded .To create a checkpoint, parameterize a step, or to add a method
from individual java applets, the Java Add-in must be loaded.

3.2.2   .Net Add-In

The .Net add-in is required to support objects developed in .Net .In some cases, even
though the application has been developed using .Net, when the page is sent to the
browser, it is a plain HTML page. Quick Test Professional can recognize HTML controls
like edit fields, buttons etc. without the .Net add-in. However, if a Web application
contains complex controls like ActiveX or other controls developed in .Net like ASP.Net
server controls, it is required to use the .Net add-in to achieve object recognition.

3.2.3   Sap Add-In

The Sap add-in is required for all SAP applications. In SAP application Grid Tables,
 Status Bar messages, Labels can be identified only if SAP Add-in is installed.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                               4.    Conventions
The Conventions for Naming for test cases, Scripts and Actions vary from Project to
Project depending upon the Client.


4.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. 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. Consistency should be maintained in following the
hierarchy of naming.

                    Use Case
                       Or                     Test Case
                    Scenario


For example:

Example 1: Considering that Each Use case is associated with one Test case. If the name
of the Use Case were UC_001 then the Test case name would be TC_001.

Example 2: In the Unilever Automation Project, SAP transactions are divided into
different modules, in those modules different transactions are grouped together as a
scenario, so for writing the test case for a particular scenario naming convention used is
module name followed by scenario name.

 For Module IMWM, if S014_01 is the scenario name, so name of the test case
for the S014_01 scenario was given as IMWM_S014_01.




4.2    Script and Action Naming Conventions:

Similar to the Test case naming, Script naming should be done consistently with clarity
and traceability. Typically each Test Script is prepared corresponding to each Test Case.
Every Test Case contains one or more Conditions. Each Condition can be represented by
an action in the script.

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


                                 Use Case


                                 Test Case


                    Condition1 Condition2 Condition3 ………



                     Test Case                      Test script

                           Condition 1             Action1

                           Condition2              Action2

Therefore for a Test Script corresponding to a Test Case named TC_001 would be
QTS_001.The hierarchy should be maintained in case the use cases or test cases are
nested.

E.g.: TC_01_014 would have a QTP Test Script as QTS_01_014.


Action Naming:
Each Test Script can contain one or more Actions, with one or more actions representing
a test Condition.
Actions can be named in 2 ways:
    1. Functionality of the Action
    2. Hierarchy of the Action in the Test Script.

   1. Functionality of the Action:
      Typically Actions are segregated by their functionality in the Test Script.
      Therefore it would be easier to understand the Action if the name of the action
      represents the Functionality.

       For E.g.: An Action written or recorded for logging the user should be named as
       Login or Authentication for easy understandability.
       An Action for booking tickets should be named as Book_Tickets
       An Action for exiting the application named as Exit.

                           This also adds a huge advantage when the Actions are made
       reusable. Reusable Actions can be used between various scripts. When an Action
       is to be made reusable the action should be named as REUSE_(Action name).
       Example: REUSE_Login.

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

      2. Hierarchy of the Action in the Script:

         Since Actions are a part of the Test Script, for purpose of Clarity and tracking,
         Actions can be named as per Hierarchy.

         For e.g.: 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.3      Variables and Constants:


QTP Scripts are in VB Script. Therefore, the naming conventions for variables can be
followed alike VB Script Naming Conventions.

General Conventions followed in VBScript are:

Data Type Prefixes:

By using data type prefixes, your variables always indicate what they are designed for.
I'm using just six prefixes:

Prefix                     Data Types                                Example
b        Boolean (true or false)                           bChecked = True
d        Date/time                                       dStartTime = Now
         All numeric data types
i                                                        iTax = iPrice * 0.076
         (Byte, Integer, Currency, Long, Single, Double)
o        Objects                                         Set oFile = Nothing
s        Strings                                         sTitle = "Welcome!"
u        User interface elements                         uPara.style.display = "block"



Constants Prefix:

Usually there are only a handful of constants in any scripts. Indicating the data type
therefore is less important for constants. Prefix letter c for all constants can be used.
e.g. Const cTitle = "Welcome!"
UDocument.title = cTitle




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


4.4      DataSheet Naming and Parameter Naming Conventions:


      Every QTP Test Script contains 2 types of sheets.
      1. Global data sheet
      2. Local data sheets

The Global data sheet, which is a common sheet for all the actions of the script, is
named by default as dt_globalsheet. This can be renamed as Global for all the Scripts for
consistency.

Typically, Each Action in the Script contains one data sheet, which is local to the
Action. This is by default, named after the Action to which it belongs. Therefore the
name of the datasheet follows directly the name of the Action, which when named
following its naming conventions, can be used efficiently for the data sheet too.


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).
‘In’ denoting that it’s an input parameter for the Test in whole. The name following IN
should be a relevant name for the variable, denoting the purpose of its use. This should
also comply with the standard variable naming conventions.
Example: IN_bFlag, IN_iIncrement etc.,

b) Test Output Parameters: On the similar lines of Input Parameters, these should be
named as OUT_(relevant variable name). OUT representing that it’s an output
parameter.
Example: OUT_sStatus.



2) Action Parameters

a) Action Input Parameters: These are local to Action of a Test. These can be named as
ACTIN_(variable name). ACTIN denoting that it’s an Action Input Parameter.
Example: ACTIN_iResult


b) Action Output Parameters: These could be named as ACTOUT_(var name).

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
Example: ACTOUT_bFlag



3) Environment Variables:

Environment variables are either built-in or User defined. Built-in variables cannot be
declared named by the user, so their naming convention is not discussed.

User Defined Environment Variables are either Internal or External.
Internal Variables: ENV_INT_(variable name)
External Variables: ENV_EXT_(Variable name)



4.5    Function Naming Conventions


Functions should be named as Func_(name). This can provide clarity and difference
between a Reusable Action and a Function that can be used within Actions.
Example: Func_Save , Func_Add




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                                 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


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


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.

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




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.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




The settings can be changed by going to

   Test>Settings>Resources>Object Repository Type




       In the Per-Action mode, 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.In the Shared mode, the user may choose a location to save the shared
       object repository files for all the tests.

       All the Objects recorded during a test,and their properties can be seen and
       manipulated in the Tools>Object Repository.There are provisions in this Object
       Repository Dialog box to add new objects,spy objects, find and replace property
       values etc.

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




      The First Section of Object Repository Dialog Box contains provisions to
       a.       Add Objects : A Button to add new objects to the repository.
       b. Highlight: To highlight the object selected in the repository, when the application
          is open.
       c. Object Spy: To Spy any Object, to see its Properties.
       d. Export: To Export any objects to an outside location.


The second section of the dialog box contains provision to Find, Replace, Add, and
Remove the properties of an object in the Repository also set any default values for the
properties.



5.5      Expert View


While recording Tests in QTP, there are 3 important views that enable us to understand
clearly, the various representations of the Script. They are
            a. Expert View
            b. Keyword View: Hierarchical Representation of Actions

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
           c. Active Screen View: Pictorial view of the currently active Screen.

In the Expert View, 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. For each object and method in an Expert
View statement, a corresponding row exists in the Keyword View and a corresponding
Active Screen in the Active Screen view, which enables easy traceability.




       Fig: Active Screen Component corresponding to Expert View Statement




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




 Fig: Keyword view and Active Screen view corresponding to one expert view statement


5.5.1   Step Generator:

If the user is familiar with VBScript, the user can add and update statements and enhance
the tests and components with programming. After the test or an Action is recorded, its
power and flexibility can be increased by adding recordable and non-recordable VBScript
statements as required for tasks like Check Points,Datatables etc.,.These additional steps
can be added either manually or using Insert>Step >Step Generator .whenever a step is
added to a script, then any Syntax errors of the step can be Identified in its Keyword
view.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




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.The generated step gets
added at the position of cursor in the expert view.
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. 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, VBScript functions, and internal script functions




5.6    Setting related to the Application Used:

The different kind of Applications that can be tested using QTP are windows
applications,web based(java and .Net),SAP,Oracle etc.Apart from the windows


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
applications using MFC and simple web applications(which can be run with default add-
ins), rest all applications require a special Add-in to be purchased to do the testing.Each



Add-in which is bought and installed, results in a new tab in all the setting dialog boxes ,
using which various setting options can be chosen.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




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




                 Fig: Record and Run Settings with a SAP Add-in.
For detailed information of the settings of the tabs other than the special tabs refer Record
and run settings.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




                                 6.      Objects

6.1   Objects

      Objects are the things which contains different properties and methods.

      For Example: Window is said to be an object which consists of properties such as
      Exist, GetROProperty and methods such as ChildObjects, Activate, maximize,
      minimize etc.

      Property:

      Property describes about the object defined, each object has different properties,
      which is necessary to describe the object, which differentiates the given object
      with other objects.

      For example: If we take a window object, we first have to define to which class it
      belongs to which is one of the property, it belongs to a window class. Exist is a
      property which is common to many objects which returns true if that object exists.

      Methods:

      Methods are functions, which are used for changing the properties of the object
      that is in order to manipulate with the object properties we use.

      For example: If we take a window object, Activate is a method used to activate
      the window object, thus by using Activate method Activate property of the
      present window object is set to true, thus the window object will be activated if
      not in activated mode.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




                    Sample for Object hierarchy:

                              Method for
                              “WinEdit”
                              Object

  “Dialog” Object



Child Object
for “Dialog”
Object




                    In the above sample of code, there are two main Objects, one is Dialog and
                    the other is Window object. This objects contain child objects, For Dialog
                    object which is named as “Login” has WinEdit object with name as “Agent
                    Name:” as childobject, here Set is the method used to set a text into the
                    WinEdit object.

                     Dialog
                                      Parent Object
                                      named as “Login”

                                                         Child Object
                          WinEdit                        named as “Agent
       www.ramupalanki.com                               Name:”
For more QTP scripts, Log onto www.ramupalanki.com


“Set” is the method associated with “WinEdit” object

                                  7.      Data Table
      In QTP scripting there are many objects that are used, One of the Objects used in
      QTP scripting is DataTable Object.



7.1      Datatable Object and related Functions:

      Description

      Basic use of Datatable object is to create an object for adding, deleting, updating data
      of an excel sheet used.

      Main functions of the datatable object:

         •   Importsheet : This function is used to Import sheet into the script, so that all
             the data in the imported sheet can be used in the script.

             Syntax:

             Datatable.Importsheet(“nameofExcelfilewithpath”,
                 “nameofthesourcesheet”, “nameofthedestinationsheet”)


         •   Exportsheet : This function is used to Export sheet from the script, all the
             data including output values are stored in the default sheet for the action, this
             sheet is exported and stored in a specified location using this function.

             Syntax:

             Datatable.Exportsheet(“nameofExcelfilewithpath”,
                   “Nameofthesheet”)

         •   Addsheet : Used for adding a sheet into the script file.


         •   GetRowCount: This function is used to get the no of rows in a particular
             sheet.

             Syntax:

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

           Datatable.AddSheet(“Sheetname”).GetRowCount



       •   GetCurrentRow: This function is used to get the current row of a particular
           sheet.

           When an action is run by using run setting as “run on all rows”, that action
           will run as many times as the number of rows in the excel sheet of the action,
           in order to find the row for which action is running currently we use
           GetCurrentRow function.

           Syntax:

           Datatable.GetSheet(“Sheetname”).GetCurrentRow



7.2    Organizing Data Sheets for Global & Local variables


Description

There are two types of sheets in any QTP Script, they are

      Globalsheet
      Localsheet

Globalsheet: Globalsheet in any script is unique, Globalsheet is used in order to store
values in the sheet and the values stored in Globalsheet can be used in all the actions.

For storing a value in the global sheet we use the following function:

               Datatable.Value(“Fieldname”,”Global”) = Value

For using the values from the global sheet we use the following function:

               Value = Datatable.Value(“Fieldname”,”Global”)

Localsheet: Each and every action in the script will have its own Localsheet, name of the
Localsheet of a particular action is same as the action name.

For using the data from the Local sheet we use following function:

           Datatable.Value(“Fieldname”,dtlocalsheet)

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
                                                   Or
                           Datatable.Value(“Fieldname”,”Sheetname”)


                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.3    Parameterizing using Data driven Wizard

                Description

                The Data Driver enables you to quickly parameterize several (or all) property
                values for test objects, checkpoints, and/or method arguments containing the same
                constant value within a given action.

                You can choose to replace all occurrences of a selected constant value with a
                parameter, in the same way that you can use a Find and Replace All operation
                instead of a step-by-step Find and Replace process. QuickTest can also show
                you each occurrence of the constant so that you can decide whether or not to
                parameterize the value.

                www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
If any property of an object is taken, that property can be parameterized using Data
driven Wizard,

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.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").WinEdit("Agent Name:").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.
        •   There will be two options to be selected as given below:




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




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




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




Parameterize all: Enables you to parameterize all occurrences of the selected value
throughout the action.
When you select this option the Parameter details area is enabled. The Finish button is
enabled when you select this option.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




Here Parameter tab can be selected using the button given at the “Parameter” radio
button, and in the next screen select the datatable Field from where the property for
which the value belongs is parametererized, click on “Finish” button thus all the instances
of the value selected for parameterization will be parameterized.



7.4    Importing and Exporting Datasheets:

Description

Importing and Exporting of Datasheets are used for reading, writing and manipulating the
data in an excel sheet.

Importing Datasheet:

Description

Imports a sheet of a specified file to a specified sheet in the run-time Data Table. The
data in the imported sheet replaces the data in the destination sheet (see SheetDest
argument).


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


Note: All the fields in the imported sheets should match with the data used in the script.
There are two functions for Importing, Importing the whole excel file and Importing the
sheets in the file.

Function for Importing the whole Excel file:

Imports the file into the script with all the sheets which are there in the excel file.

Note: Sheets in the excel file should match with the Actions in the script to use the data
efficiently, since action name and corresponding sheet name should be same.

Syntax:

Import “filenamewithpath”

Function for Importing the sheets from the excel file:

Imports the specified sheet into the script.

Syntax:

Importsheet “filenamewithpath”,”sourcesheetname”,
        ”destinationsheetname”


Exporting Datasheet:

Description

Exports a specified sheet of the run-time Data Table to the specified file.

    •   If the specified file does not exist, a new file is created and the specified sheet is
        saved.
    •   If the current file exists, but the file does not contain a sheet with the specified
        sheet name, the sheet is inserted as the last sheet of the file.
    •   If the current file exists and the file contains the specified sheet, the exported
        sheet overwrites the existing sheet.

Same as Importing, There are two functions for Exporting, 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.

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


Syntax:

Export “filenamewithpath”

Function for Exporting the sheets from the excel file:

Exports the specified sheet into the script.

Syntax:

Exportsheet “filenamewithpath”,”sourcesheetname”,
        ”destinationsheetname”




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


                                   8.      Actions

8.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, to run iterations on all rows in the Data Table,
or to run iterations only for certain rows in the Data Table.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com



8.2    Iterations using rows

       The Run tab includes the following options:

         Option                                   Description
                     Runs the called action only once, using the row in the action's data
                     sheet that corresponds to the current global iteration number. If the
                     action's data sheet contains fewer rows than the global sheet, the last
                     row of the action's data sheet is used for each subsequent test
                     iteration.

                     For example, suppose an action's data sheet has two rows and the
                     global sheet has four rows. If you choose to run one iteration only
                     for the action and you choose to run iterations on all rows of the
       Run one
                     global data sheet, then during each iteration of the test, this action
       iteration
                     will run only one iteration. The data that the action parameters use
       only
                     during each repetition of the test are based on the iteration number
                     for the test.
                     During the first iteration of the test, Data Table parameters in the
                     action take data from the first row of the action's data sheet. In the
                     second iteration of the test, Data Table parameters in the action take
                     data from the second row of the action's data sheet. In the third and
                     subsequent iterations of the test, the Data Table parameters in the
                     action continue to take data from the second i.e. the last row of the
                     action's data sheet.
       Run on all    Runs the called action with the number of iterations according to the
       rows          number of rows in the action's Data Table.
       Run from
                     Runs the called action with the number of iterations according to the
       row __ to
                     specified row range.
       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.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


8.3       Action Template

Creating an Action Template

If you want to include one or more statements in every new action in your test, you can
create an action template. For example, if you always enter your name as the author of an
action, you can add this comment line to your action template. An action template applies
only to actions created on your computer.
To create an action template:

1. Create a text file containing the comments, function calls, 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.

2. Save the text file as ActionTemplate.mst in your <QuickTest Installation
Folder>dat folder. All new actions you create contain the script lines from the
action template.

Only the file name ActionTemplate.mst is recognized as an action template.


                                             ActionTemplate.mst
To view the Action template refer to




8.4       Script Startup

      •   Check for the required add-ins for an application.
      •   Include action template for every test containing script id, Action name, Action
          Description, Recovery scenario used etc.
      •   Every action, scenario must be specified with an appropriate name.
      •   Check for mandatory input fields for all iterations in the datasheets that are being
          imported.

Example:
The Resources tab of the Test Settings dialog box can be used to associate specific files
with the test, such as Data Table files.

The option area Other location instructs Quick Test to use data stored in the specified
Data Table location. The Data Table can be any Microsoft Excel (.xls) file.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




          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.

          For further details refer to QTP test settings doc.


8.5       Splitting Actions, Re-usable Actions, Internal/External Actions

Actions help divide your test into logical units, specific activities that you perform
in your application.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
A test is made up of calls to actions. When you create a new test, it contains a call to a
single action or create tests that call multiple actions by inserting calls to them, to make
the design more modular and efficient tests.

There are three kinds of actions:

           •   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.
           •   external action—a reusable action stored with another test.
               External actions are read-only in the calling test. They can be
               modified only in the test with which they are stored.
           •   Non-resuable-actions —an action that can be called only in the
               test with which it is stored, and can be called only once.




For further details on creation & splitting of actions refer to Actions.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                        9.      Object Repository

9.1    Per Action/Shared Object Repository:

Setting the Shared /per action Object Repository option

To set only one test to use the Shared Object Repository option:

1. Click the "New" button or go to File -> New to open a new test.
2. Go to Test -> Settings.
3. Select the Resources tab.
4. In the Object repository type box, select one of the options:




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


   •   Select "Per-action" to set the Object Repository mode for your test to the Object
       Repository per action mode.

       Below are some of the factors based on which Per Action option is selected

           •   Whenever there are no common objects across transactions
           •   Ease of building object repository.
           •   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.

       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. If you selected Shared in step 4, specify the Shared Object Repository file you want to
use as the test's Object Repository file. To specify a file, enter the Object Repository file
name or click the "Browse" button and select a resource file (*.tsr) from the Open dialog
box. To create a new Shared Object Repository file, enter a new file name in the Shared
box.

Note: These steps need to be done in a new script. Once you have modified the script,
you will not be able to change the option.


To set all new scripts to use a Shared Object Repository:

For Quick Test Professional 6.5 and above
1. Click the New button or go to File -> New to open a new test.
2. Go to Test -> Settings.
3. Select the Resources tab.
4. Select the Shared option for the "Object-repository type".
5. Specify the Shared Object Repository file you want to use as the test's Object
Repository file. To specify a file, enter the Object Repository file name or click the
ellipse button <...> and select a resource file (*.tsr) from the Open dialog box. To create a
new Shared Object Repository file, enter a new file name and path in the Shared box.
6. Click the "Set as Default" button.
7. Click <Apply> and <OK>.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com



9.2    Merging of two object repositories:

General:

The Object Repository File Merge Utility allows users to merge object repository files
into a single file. This utility is intended for an advanced user that builds powerful tests.

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.

Conflicts:
The implementation of the merge algorithm is quite simple when the object repository
files have different objects in them, or if all objects had only exact replicas in other files.
Due to the nature of the operation it is often not the case. For example, if we try to merge
two object repositories from tests that were recorded at different time points, between
which some test objects properties have changed (e.g. whether a button is enabled) then
the same object exists in the two repositories with different properties. We call this a
description conflict as the two objects have the same name, but different descriptive
properties. It can also be that the user has decided to modify the automatically assigned
logical name of an object (for example, in order to create a shorter name) in one
repository but not in the other. In this case, two objects will exist with different logical
names, but with the same descriptive properties. We call this a name conflict.

Resolving Conflicts:

It is not trivial to identify and handle conflicting objects. The user might want to merge
two objects that were not initially the same, or decide to keep two objects that for the
inexperienced eye would seem identical. For example, recording on web browsers would
likely generate identical logical names for browsers that have nothing in common. It is
also likely that if the text on a button has changed, new tests would record a new logical
name for it, even though the object behavior has not changed. It is therefore possible to
either keep the two objects (and their subtrees) separated, to assume that the two objects
are actually the same object, or to ignore one of the conflicting object. We will discuss
these choices later in detail.

Note: The Merge Utility works only on machines where QTP8.0 is installed.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


Merge Object Repositories Utility

Main Window:
This utility is designed to supply simple access to the functionality implemented by the
ObjectRepositoryMgr COM component. As the operation is not trivial, the UI has many
options to select, so we will discuss the different options in detail.




For different options of Merging refer to Merging of Object Repositories.



9.3    Limitations:

1. Mercury Interactive recommends that you keep the Object Repository under 1 MB and
perform regular backups. If the size crosses more than 1MB loading of object repository
takes lot of time .

2. The limitation on the number of Actions is 255. 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


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


255 Actions per test. You may be able to add additional Actions after reaching the 255
"limit", however those Actions will not be able to access a local data sheet.

Note: If you are calling reusable Actions, you may be able to have more than 255
Actions within the script. This can be accomplished if you are calling the same Action
more than one time within the script. The data sheet for the Action will only be loaded
once. This applies to "call to" Actions only.

Example:
In a new script, insert a "call to" a reusable Action. When the Action is added to the
script, you will see the data sheet added to the data table. Insert another "call to" to the
same Action. The data sheet will not be added again.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                                  10. Variables
In QTP scripting there are mainly 3 types of variable that we use. They are:
    • Action Parameters.
    • Environment Variables.
    • VB Variables, which we declare in the script.



10.1 Action Parameters

Action parameters enable you to transfer values between actions and their nested
actions in your test, from your test to a top-level action, or from a step in a top-
level action back to the script or action that ran (called) your test. For example,
you can output a value from a step in a nested action and store it in an output
action parameter, and then use that value as input in a later step in the calling
parent action.

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. 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.

You can specify input parameters for an action so it can receive input values from
elsewhere in the test. Input values for an action 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). You
can also specify output parameters for an action, so that it can output values for use later
in the test, or pass values back to the application that ran (called) the test.


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. 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). You can specify output parameters for an action, so that it can return
values for use later in the test. For each input or output action parameter, you define a
name and a type. You can also specify a default value for each action input parameter, or
you can use the default value that QuickTest provides for the parameter value type that
you choose. 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. You can define, modify, and delete input
and output parameters in the Parameters tab of the Action Properties dialog box.



www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




To add a new input or output action parameter:

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


           o  Number—Any positive or negative number. The default value is
              0.
          o Password—An encrypted password value. If you select a
              Password value type, the password characters are masked when
              you enter the password in the Default Value field. The default
              value is an empty string.
          o Any—A variant value type, which accepts any of the above value
              types. Note that if you select the Any value type, you must specify
              the value in the format that is required in the location where you
              intend to use the value. For example, if you intend to use the value
              later as a string, you must enclose it in quotation marks. When you
              specify a value of Any type, QuickTest checks whether it is a
              number. If the value is not a number, QuickTest automatically
              encloses it in quotation marks. If you are editing an existing value,
              QuickTest automatically encloses it in quotation marks if the
              previous value had quotation marks. The default value is an empty
              string.
   4. If you are defining an input action parameter, 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. The
      default value is required so that you can run the action without receiving
      parameter values from elsewhere in the test.
   5. If you wish, click in the Description box, then enter a description of the
      parameter, for example, the purpose of the parameter in the action.

To modify an existing action parameter:

   1. Select the parameter you want to modify from the Input parameters or
      Output parameters list.
   2. Modify the values as necessary in the edit boxes of the parameter row.

To delete an existing action parameter:

   1. Select the parameter you want to delete from the Input parameters or
      Output parameters list.
   2. Click the Delete button      . The parameter is removed from the list.



10.2 Test Parameters

In the Parameters tab of Test Settings, you can define input parameters that pass values
into your test or component and output parameters that pass values from your test or


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

component to external sources. You can also use the Parameters tab to modify or delete
existing test or component parameters




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.
           •   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.

You can add and delete input and output parameters for your test or component
using the parameter control buttons:


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


       Option                                   Description
                Adds a parameter to the appropriate parameter list. Enter a name for the
                new parameter and select the parameter type. You can enter a description
                for the parameter, for example, the purpose of the parameter in the
                component. If you are defining an input parameter, enter a default value
                for the parameter in the Default Value column.
                You define test or component parameters in the same way you define
                action parameters.

                Removes the selected parameter from the test or component.


Defining Values for Input Parameters

When the test or component runs, 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.
When you run a test or business component from QuickTest, input parameter
values for tests and components are taken from in the Input Parameters tab of the
Run dialog box.

Using Test or Component Parameters

Once you have defined test or component parameters, you insert them in your test
or component by specifying the test or component parameter name with the
Parameter reserved object, in the format: Parameter("ParameterName").


10.3 Environment Variables

QuickTest can insert a value from the Environment variable list, which is a list of
variables and corresponding values that can be accessed from your test. Throughout the
test run, the value of an environment variable remains the same, regardless of the number
of iterations, unless you change the value of the variable programmatically in your script.

There are three types of environment variables:

   •   User-Defined Internal—variables that you define within the test. These
       variables are saved with the test and are accessible only within the test in
       which they were defined.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
       You can create or modify internal, user-defined environment variables for
       your test in the Environment tab of the Test Settings dialog box or in the
       Parameter Options dialog box.
       Tip: You can also create environment output values, which retrieve values
       during the test run and output them to internal environment variable
       parameters for use in your test.

   •   User-Defined External—variables that you predefine in the active
       external environment variables file. You can create as many files as you
       want and select an appropriate file for each test, or change files for each
       test run. Note that external environment variable values are designated as
       read-only within the test.



   •   Built-in—variables that represent information about the test and the
       computer on which the test is run, such as Test path and Operating system.
       These variables are accessible from all tests, and are designated as read-
       only.

       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. You should not use the names of these variables for any other
       purpose.



10.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 subsequently retrieve these values and use them as input at a
different stage in the run session. You can pass variables from one action to another by
setting Action Call Parameter Values. 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. You can also parameterize the value used for a particular input action
parameter using any available parameter type.

The actual input and output action parameters that an action can receive or return, and
their types, are defined in the Action Properties dialog box. If you do not set a value for
an input action parameter in the Action Call Properties dialog box, the default value that
is specified in the Action Properties dialog box is used.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




You can specify a location in which to store the output action parameter values, which
can be used in the called action.




To specify a location in which to store an output action parameter value:

   1. In the Output parameters area, click in the Store In box for the
      parameter and enter a variable name.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com




       If we choose variable to store the value, then the value is stored in a run-
       time variable for the duration of the run session. You can accept the
       default name assigned to the variable or enter a different variable name.

       Alternatively, 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. You can select to store the
       value in a test or action parameter, a Data Table parameter, or an
       environment parameter.

   2. Repeat this procedure for each output action parameter value in the list.



10.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. If you change the action parameters defined for an action, and then view the
action properties for a call to that same action in a different part of the test, you can see
the action parameters have changed. However, 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. When you insert a call to a copy of an action, the copy of the
action is inserted with the action parameters and action call parameter values that were

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
defined for the action you copied. When you split an action, the action parameters are
copied to both actions. The action call values for the second action are taken from the
default values of that action's parameters.

Environment variables can be accessed from your test. Throughout the test run,
the value of an environment variable remains the same, regardless of the number
of iterations, unless you change the value of the variable programmatically in
your script.

There are three types of environment variables:

    User-Defined Internal—variables that you define within the test. These
     variables are saved with the test and are accessible only within the test in
     which they were defined.

       You can create or modify internal, user-defined environment variables for
       your test in the Environment tab of the Test Settings dialog box or in the
       Parameter Options dialog box.

    User-Defined External—variables that you predefine in the active
     external environment variables file. You can create as many files as you
     want and select an appropriate file for each test, or change files for each
     test run. Note that external environment variable values are designated as
     read-only within the test.



    Built-in—variables that represent information about the test and the
     computer on which the test is run, such as Test path and Operating system.
     These variables are accessible from all tests, and are designated as read-
     only.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

                              11. Check Points
A checkpoint is a verification point that compares a current value for a specified property
with the expected value for that property.


11.1 Types of Checkpoints

In QTP the following types of checkpoints can be inserted to check various objects in a
Web site or application.


   •       Standard Checkpoint checks the property value of an object in your
       application or Web page. The standard checkpoint checks a variety of objects
       such as buttons, radio buttons, combo boxes, lists, etc. For example, you can
       check that a radio button is activated after it is selected or you can check the value
       of an edit field.

       Note: Standard checkpoints are supported for all add-in environments

   •   Image Checkpoint checks the value of an image in the application or Web page.
       For example, we can check that a selected image's source file is correct.

       Note: Image checkpoint can be created by inserting a standard checkpoint on an
       image object.

       Image checkpoints are supported only for the Web environment


   •        Bitmap Checkpoint checks an area of a Web page or an application as a
       bitmap. For example, consider a Web site that can display a map of a city the user
       specifies. The map has control keys for zooming. We can record the new map that
       is displayed after one click on the control key that zooms in the map. Using the
       bitmap checkpoint, 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. For example, suppose
       an application or Web site contains a table listing all available flights from New
       York to San Francisco. You can add a table checkpoint to check that the time of
       the first flight in the table is correct.




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


      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.


  •       Text Checkpoint checks that a text string is displayed in the appropriate
      place in the application or a Web page. For example, consider an application or
      Web page that displays the sentence Flight departing from New York to San
      Francisco. We can create a text checkpoint that checks that the words "New
      York" are displayed between "Flight departing from" and "to San Francisco".

      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, according to specified criteria. For example,
      suppose your Visual Basic application has a button that says View Doc <Num>,
      where <Num> is replaced by the four digit code entered in a form elsewhere in
      the application. 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.

      Text area checkpoints are supported for Standard Windows, Visual Basic, and
      ActiveX add-in environments Text area checkpoints are also supported for some
      external add-in environments.


  •       Accessibility Checkpoint identifies areas of your Web site that may not
      conform to the World Wide Web Consortium (W3C) Web Content Accessibility
      Guidelines. For example, guideline 1.1 of the W3C Web Content Accessibility
      Guidelines requires you to provide a text equivalent for every non-text element.
      You can add an Alt property check to check whether objects that require the Alt
      property under this guideline, do in fact have this tag.

      Accessibility checkpoints are supported for the Web environment

  •   Page Checkpoint checks the characteristics of a Web page. For example, you can
      check how long a Web page takes to load or whether a Web page contains broken
      links.

      Note: You create a page checkpoint by inserting a standard checkpoint on a page
      object.

      Page checkpoints are supported for the Web environment

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com


   •       Database Checkpoint checks the contents of a database accessed by your
       Web site. For example, you can use a database checkpoint to check the contents
       of a database containing flight information for your Web site.

       Database checkpoints are supported by all environments.


   •       XML Checkpoint checks the data content of XML documents in XML files
       or XML documents in Web pages and frames. XML checkpoints (Web
       page/frame) are supported for the Web environment; 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.

   •   To add checkpoints while recording
   •   To add a checkpoint while editing the test

For more information refer to Checkpoints



11.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




www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

Adding output values in a test in QTP

   •   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.
Note: If you insert an output value on a Web page, the Page Output Value
Properties dialog box opens. This dialog except that it contains two additional
option areas, HTML verification and All objects in page. These options are
relevant only for checkpoints and are disabled when defining output values.




   The output values can be output to either of these locations:

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
       •   GlobalLocal Sheet
       •   Environment variables
       •   ActionTest Parameter.

This option is given in the output options dialog box




                         12. Reusable Library
Description

www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com

When forming a new product the traditional engineer can take advantage of ready-made
subassemblies. To the test engineer, reusable software components offer the same
possibilities; the same components can be incorporated into many whole new systems,
thus saving the considerable time and effort it can take to generate new software.

Starting with an introduction to software reuse and a discussion of its feasibility, the
authors go on to consider how the components that may be found could be used. The
reusable library was designed with reuse very much in mind, making it essentially a
small, but invaluable, library.



12.1           Introduction

In QTP we can create VBScript library files containing VBScript functions, subroutines,
classes, modules, etc., and then associate the files with our test. We can call any VBScript
function, subroutine, etc., contained within any library file that is associated with our test.
Any text file written in standard VBScript syntax can act as a library file.


   a) Functions
        i. Built-In

         ii.   User defined

               We can specify the default library files for all new tests in the Test
               Settings dialog box (Test > Settings > Resources tab). We can also edit
               the list of associated library files for an existing test in the Test Settings
               dialog box. Note that once a test is created, 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. Changes to the default library files list in the
               Test.




12.2 How to establish a Reusable Library


www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
a. Defining Resource Settings for Your Test
We can use the Resources tab of the Test Settings dialog box to associate specific files
with your test, such as VBScript library files and Data Table files, and to specify the
object repository mode and file to use for our test. We can also set the currently
associated library files and object repository settings as the default settings for all new
tests.




b. Executing Externally-Defined Functions from Your Test
We can create a VBScript file and call its functions, subroutines, classes, etc., from an
action in your test or from an associated library file by inserting an ExecuteFile
statement in our action or library file.




When we run our test, 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.



www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
To execute an externally-defined function:

                          1. Create a VBScript file using standard VBScript
                             syntax.
                          2. Store the file in any folder that you can access from
                             the machine running your test.
                          3. 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.

           1. Use the functions, subroutines, classes, etc., from the specified
              VBScript file as necessary in your action or within other functions
              in an associated library file.



12.3 How to use this Reusable Library.




                       13. Regular Expressions

13.1 Description
www.ramupalanki.com
For more QTP scripts, Log onto www.ramupalanki.com
While creating checkpoints we have an option only to search or check for a specific text
         string or a specific value of a property. To increase the flexibility and adaptability
of the tests we use regular expressions.
Regular Expressions enable Quick Test to identify objects and text strings with varying
values.

A regular expression is a string that specifies a complex search phrase. By using special
characters we define the conditions of the search.

The most common expressions that can be used to create regular expressions are:


1. Using the Backslash Character

A backslash () instructs Quick Test to treat the next character as a literal
character, if it is otherwise a special character. The backslash () can also instruct
Quick Test to recognize certain ordinary characters as special characters.

For example, consider a Web site called:

       mercurytours.mercuryinteractive.com

The period would be mistaken as an indication of a regular expression. To
indicate that the period is not part of a regular expression, you would write it as
follows:

       mercurytours.mercuryinteractive.com




2. Matching Any Single Character

A period (.) instructs Quick Test to search for any single character (except for n).
For example:
       welcome.
matches welcomes, welcomed, or welcome followed by a space or any other
single character. A series of periods indicates the same number of unspecified
characters.
To match any single character including n, enter: (.|n)


3. Matching Any Single Character in a List

Square brackets instruct QuickTest to search for any single character within a list of
characters. For example, to search for the date 1967, 1968, or 1969, write: 196[789]

4. Matching Any Single Character Not in a List

www.ramupalanki.com
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework
Automation framework

More Related Content

Similar to Automation framework

V mware service-def-private-cloud-11q1-white-paper
V mware service-def-private-cloud-11q1-white-paperV mware service-def-private-cloud-11q1-white-paper
V mware service-def-private-cloud-11q1-white-paperChiến Nguyễn
 
A guide for automated testing
A guide for automated testingA guide for automated testing
A guide for automated testingMoataz Nabil
 
Oracle Analytics Server Infrastructure Tuning guide v2.pdf
Oracle Analytics Server Infrastructure Tuning guide v2.pdfOracle Analytics Server Infrastructure Tuning guide v2.pdf
Oracle Analytics Server Infrastructure Tuning guide v2.pdfsivakodali7
 
Basics of QTP Framework
Basics of QTP FrameworkBasics of QTP Framework
Basics of QTP FrameworkAnish10110
 
LPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] ReportLPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] ReportNandu B Rajan
 
Livre blanc technique sur l&rsquo;architecture de référence
Livre blanc technique sur l&rsquo;architecture de référenceLivre blanc technique sur l&rsquo;architecture de référence
Livre blanc technique sur l&rsquo;architecture de référenceMicrosoft France
 
Accenture Case Study Solution by Amit Bhardwaj
Accenture Case Study Solution by Amit BhardwajAccenture Case Study Solution by Amit Bhardwaj
Accenture Case Study Solution by Amit BhardwajAmit Bhardwaj
 
S4 h 301 testyourprocesses_userguide
S4 h 301 testyourprocesses_userguideS4 h 301 testyourprocesses_userguide
S4 h 301 testyourprocesses_userguideLokesh Modem
 
Sap s4 hana 1709 op sap api-master guide
Sap s4 hana 1709 op sap api-master guideSap s4 hana 1709 op sap api-master guide
Sap s4 hana 1709 op sap api-master guidemutia_arum
 
SAP Performance Testing Best Practice Guide v1.0
SAP Performance Testing Best Practice Guide v1.0SAP Performance Testing Best Practice Guide v1.0
SAP Performance Testing Best Practice Guide v1.0Argos
 
Sap performance testing best practice guidev1 0-130121141448-phpapp02
Sap performance testing best practice guidev1 0-130121141448-phpapp02Sap performance testing best practice guidev1 0-130121141448-phpapp02
Sap performance testing best practice guidev1 0-130121141448-phpapp02Kamalaksha Das
 
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02Pompee Das
 
Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Roy Muy Golfo
 
Istqb Agile-tester Extension
Istqb Agile-tester ExtensionIstqb Agile-tester Extension
Istqb Agile-tester ExtensionGirish Goutam
 
Ibm mobile first strategy software approach
Ibm mobile first strategy software approachIbm mobile first strategy software approach
Ibm mobile first strategy software approachbupbechanhgmail
 
bkremer-report-final
bkremer-report-finalbkremer-report-final
bkremer-report-finalBen Kremer
 

Similar to Automation framework (20)

V mware service-def-private-cloud-11q1-white-paper
V mware service-def-private-cloud-11q1-white-paperV mware service-def-private-cloud-11q1-white-paper
V mware service-def-private-cloud-11q1-white-paper
 
Xi31 sp3 bip_admin_en
Xi31 sp3 bip_admin_enXi31 sp3 bip_admin_en
Xi31 sp3 bip_admin_en
 
A guide for automated testing
A guide for automated testingA guide for automated testing
A guide for automated testing
 
Oracle Analytics Server Infrastructure Tuning guide v2.pdf
Oracle Analytics Server Infrastructure Tuning guide v2.pdfOracle Analytics Server Infrastructure Tuning guide v2.pdf
Oracle Analytics Server Infrastructure Tuning guide v2.pdf
 
Basics of QTP Framework
Basics of QTP FrameworkBasics of QTP Framework
Basics of QTP Framework
 
Bp ttutorial
Bp ttutorialBp ttutorial
Bp ttutorial
 
LPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] ReportLPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] Report
 
Livre blanc technique sur l&rsquo;architecture de référence
Livre blanc technique sur l&rsquo;architecture de référenceLivre blanc technique sur l&rsquo;architecture de référence
Livre blanc technique sur l&rsquo;architecture de référence
 
Accenture Case Study Solution by Amit Bhardwaj
Accenture Case Study Solution by Amit BhardwajAccenture Case Study Solution by Amit Bhardwaj
Accenture Case Study Solution by Amit Bhardwaj
 
Test automation
Test automationTest automation
Test automation
 
S4 h 301 testyourprocesses_userguide
S4 h 301 testyourprocesses_userguideS4 h 301 testyourprocesses_userguide
S4 h 301 testyourprocesses_userguide
 
Sap s4 hana 1709 op sap api-master guide
Sap s4 hana 1709 op sap api-master guideSap s4 hana 1709 op sap api-master guide
Sap s4 hana 1709 op sap api-master guide
 
SAP Performance Testing Best Practice Guide v1.0
SAP Performance Testing Best Practice Guide v1.0SAP Performance Testing Best Practice Guide v1.0
SAP Performance Testing Best Practice Guide v1.0
 
Sap performance testing best practice guidev1 0-130121141448-phpapp02
Sap performance testing best practice guidev1 0-130121141448-phpapp02Sap performance testing best practice guidev1 0-130121141448-phpapp02
Sap performance testing best practice guidev1 0-130121141448-phpapp02
 
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02
Sapperformancetestingbestpracticeguidev1 0-130121141448-phpapp02
 
Mts srcp
Mts srcpMts srcp
Mts srcp
 
Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)
 
Istqb Agile-tester Extension
Istqb Agile-tester ExtensionIstqb Agile-tester Extension
Istqb Agile-tester Extension
 
Ibm mobile first strategy software approach
Ibm mobile first strategy software approachIbm mobile first strategy software approach
Ibm mobile first strategy software approach
 
bkremer-report-final
bkremer-report-finalbkremer-report-final
bkremer-report-final
 

More from Ramu Palanki

Qtp sample certification questions and answers
Qtp sample certification questions and answersQtp sample certification questions and answers
Qtp sample certification questions and answersRamu Palanki
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scriptsRamu Palanki
 
Qtp questions and answers
Qtp questions and answersQtp questions and answers
Qtp questions and answersRamu Palanki
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginnersRamu Palanki
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questionsRamu Palanki
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answersRamu Palanki
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3Ramu Palanki
 
Qtp complete guide for all
Qtp complete guide for allQtp complete guide for all
Qtp complete guide for allRamu Palanki
 
Qtp compare two xml files
Qtp compare two xml filesQtp compare two xml files
Qtp compare two xml filesRamu Palanki
 
Qtp change excel cell color with condition
Qtp change excel cell color with conditionQtp change excel cell color with condition
Qtp change excel cell color with conditionRamu Palanki
 
Qtp certification questions
Qtp certification questionsQtp certification questions
Qtp certification questionsRamu Palanki
 
Qtp certification questions and tutorial
Qtp certification questions and tutorialQtp certification questions and tutorial
Qtp certification questions and tutorialRamu Palanki
 
Qtp certification questions2
Qtp certification questions2Qtp certification questions2
Qtp certification questions2Ramu Palanki
 
Qtp automation estimation techniques
Qtp automation estimation techniquesQtp automation estimation techniques
Qtp automation estimation techniquesRamu Palanki
 
Qtp 11 new enhacements in
Qtp 11 new enhacements inQtp 11 new enhacements in
Qtp 11 new enhacements inRamu Palanki
 
Qtp passing parameters between actions
Qtp passing parameters between actionsQtp passing parameters between actions
Qtp passing parameters between actionsRamu Palanki
 

More from Ramu Palanki (20)

Qtp sample certification questions and answers
Qtp sample certification questions and answersQtp sample certification questions and answers
Qtp sample certification questions and answers
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scripts
 
Qtp questions and answers
Qtp questions and answersQtp questions and answers
Qtp questions and answers
 
Qtp presentation
Qtp presentationQtp presentation
Qtp presentation
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginners
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questions
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
 
Qtp complete guide for all
Qtp complete guide for allQtp complete guide for all
Qtp complete guide for all
 
Qtp compare two xml files
Qtp compare two xml filesQtp compare two xml files
Qtp compare two xml files
 
Qtp change excel cell color with condition
Qtp change excel cell color with conditionQtp change excel cell color with condition
Qtp change excel cell color with condition
 
Qtp certification questions
Qtp certification questionsQtp certification questions
Qtp certification questions
 
Qtp certification questions and tutorial
Qtp certification questions and tutorialQtp certification questions and tutorial
Qtp certification questions and tutorial
 
Qtp certification questions2
Qtp certification questions2Qtp certification questions2
Qtp certification questions2
 
Qtp best tutorial
Qtp best tutorialQtp best tutorial
Qtp best tutorial
 
Qtp basic stuff
Qtp basic stuffQtp basic stuff
Qtp basic stuff
 
Qtp automation estimation techniques
Qtp automation estimation techniquesQtp automation estimation techniques
Qtp automation estimation techniques
 
Qtp 11 new enhacements in
Qtp 11 new enhacements inQtp 11 new enhacements in
Qtp 11 new enhacements in
 
Qtp sample resume
Qtp sample resumeQtp sample resume
Qtp sample resume
 
Qtp passing parameters between actions
Qtp passing parameters between actionsQtp passing parameters between actions
Qtp passing parameters between actions
 

Recently uploaded

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Automation framework

  • 1. For more QTP scripts, Log onto www.ramupalanki.com QTP Frame Work www.ramupalanki.com
  • 2. For more QTP scripts, Log onto www.ramupalanki.com 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................................................................54 9.1 Per Action/Shared Object Repository:.....................................................................54 9.2 Merging of two object repositories:.........................................................................56 9.3 Limitations:..............................................................................................................57 10. Variables...........................................................................59 10.1 Action Parameters................................................................................................59 www.ramupalanki.com
  • 3. For more QTP scripts, Log onto www.ramupalanki.com 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 www.ramupalanki.com
  • 4. For more QTP scripts, Log onto www.ramupalanki.com 1.2 Approach for Test Automation Description www.ramupalanki.com
  • 5. For more QTP scripts, Log onto www.ramupalanki.com Approach for Test Automation is used for building a strategy for automation starting from the Requirement phase till the deployment phase. Approach for automation begins with finding out the conditions and business rules given by the client and grouping similar conditions, business rules together as Test cases or Test Scenarios. 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, Team was divided into two, SAP Consultants. Testing Team. Requirement gathering from the client included knowledge transfer at onsite, where all the transactions including the customized transactions where explained to the SAP Consultants of satyam, Under standing of requirements was done at the client side, Depending on the flow of transactions, all the transactions where grouped together as different scenarios. While SAP Consultants where onsite for gathering Requirements, 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, user accounts for SAP access, Installation of QTP and SAP. All the Identified Scenarios which consists of different transactions where explained to Testing Team. Then common functionalities where identified, and grouped together as different Test cases. After defining different Test cases, design for automation of scripts was done, where Reusability was one of the main aspects, where all the transactions, which are common in the scenarios, are identified as Reusable transactions. Automation Framework: For Quality deliverables, important things that should be followed are: • Following common coding structure for all the scripts www.ramupalanki.com
  • 6. For more QTP scripts, Log onto www.ramupalanki.com • 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, This Action intern will call all the other actions (Each Transaction used in the script would be an action) in the script. Importing and Exporting of sheets is also done in this main action. Importing of sheets is done at the beginning before calling other actions and exporting of sheets is done at the last. Sheets corresponding to all the actions in the scripts are imported, so that the data in the fields of the Imported sheets are used as input data to the script, output data from the script is also collected and exported to the corresponding sheet. There are many transactions which are reused in the scripts, similar transactions (Actions) are made as reusable so that its not required to record those transactions again and again, which ever transaction was common among scripts, were recorded in one script and is reused in all the scripts where the transaction is required. 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. Major types of Recovery used in this project where Popup Window, Object state and on Error Recoveries. In Error handling using Recovery, all the common types of exceptions or errors are given common Recovery scenarios using regular expressions, which minimized the number of Recovery scenarios and Functions used. Design for Structure of Scripts used in Unilever Project: Main Action, which calls all the other Called Actions www.ramupalanki.com
  • 7. For more QTP scripts, Log onto www.ramupalanki.com Actions (transactions) in the script <Action Name> Main Action Calls in the Script <Action Name> Ex: S014_001 (Action Name) Ex: ME21N (Action Name Which is same as the Transaction name in SAP) www.ramupalanki.com
  • 8. For more QTP scripts, Log onto www.ramupalanki.com Design of the Approach for Test Automation is given below Identification of Test Cases for Automation Identification of Common Functionality Coding Standards, Naming Conventions & Templates Building the Re-Usable Library Tool & Application General library Application Login, Settings, Restoring, containing String Error handling, Log Logout, Common Object Repository, handling, Date handling, Reporting, Functionality Recovery, House File Handling, Data messaging etc Related code etc Keeping etc Table handling Script Development using Record & Play back Deliver the script after Verification & Validation www.ramupalanki.com
  • 9. For more QTP scripts, Log onto www.ramupalanki.com Design for Automation of Test cases for Unilever Foods: 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, Creating a Transfer Requirement and a Transfer Order. Actions for the Transactions Login, LB01, MM03, LT04, LT012 and Logoff. Common Functions are LT12, MM03 Coding Standards & Naming Conventions like ‘The file name as per convention - Scenario name’, ‘The Action named as per transaction ID’ Building the Re-Usable Library like ‘The common functionality being reused’ Application Recoveries are Error handling like On Login, Logout gAlready_exist.qrs Error Resume Next, and common S014_164_Materia Reporting like functions like l_Not_Maintained. reporter.ReportEvent LT12, MM03 qrs 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. QTP Framework in SAP Automation www.ramupalanki.com
  • 10. For more QTP scripts, Log onto www.ramupalanki.com Test Results Test Data SAP Script for Reporting Handling and Application Business and Data Sheet Session Transaction/ Application Importing Login Test Case Closing. Re-Usable Library: Generic Library calls for handling data, date, 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. • 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.g. creating customer records, Invoicing and other high volume activities where software failure would occur frequently have been considered. • Mission critical processes like core activities like sales order processing are prime candidates for automated testing and have been considered for automation. • Repetitive Testing www.ramupalanki.com
  • 11. For more QTP scripts, Log onto www.ramupalanki.com • Applications with Long Life span – Longer the application in production greater the benefits from automation. • Avoiding dynamic screens. Though possible to automate this increases the complexity of the script. • 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. If the numbers of rows were very high the execution time of the script would be high. This leads to performance issues of the recorded script. Hence, it is better to prove the business scenario wherein tables with row selections figure by identifying a fixed row number. 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 scenarios that require high degree of coding while automating so that script’s complexity is reduced and high maintainability of the script is ensured. 2. Introduction to QTP www.ramupalanki.com
  • 12. For more QTP scripts, Log onto www.ramupalanki.com 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: www.ramupalanki.com
  • 13. For more QTP scripts, Log onto www.ramupalanki.com - Oracle - Microsoft - IBM - BEA - ODBC - COM / COM+ Multimedia: - Flash - RealAudio / RealVideo - Windows Media Player Operating Environment Operating Systems Windows XP/2000/NT Supported: Windows 95/98/ME Databases Supported: (Not Applicable) Networks Supported: TCP/IP Programming JavaScript Languages Supported: 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 : IBM-PC or compatible with a Pentium® II 266 MHz Computer/Processor: microprocessor (366 MHz recommended). Windows® 98 Second Edition, Windows® 2000— Service Pack 3, Operating System: Windows NT® 4.0—Service Pack 6a, Windows® Me, or Windows® XP—Service Pack 1. www.ramupalanki.com
  • 14. For more QTP scripts, Log onto www.ramupalanki.com Memory: 128 MB of RAM (256 MB recommended) Free Hard Disk 150 MB of free disk space for a compact installation or Space: 200 MB for a typical or complete installation Microsoft Internet Explorer 5.0–6.0. Browser: Supported Environments QuickTest Professional supports creating, recording, and running tests in the environments described below.  Standard Windows Applications 1. Win32 API 2. 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: www.ramupalanki.com
  • 15. For more QTP scripts, Log onto www.ramupalanki.com Name ProgId FarPoint Spreadsheet 2.5 FPSpread.Spread.1 FarPoint Spreadsheet 3.0 FPSpread.Spread.2 FarPoint Spreadsheet 3.5 FPSpread.Spread.3 FarPoint Spreadsheet 6.0 FPSpread.Spread.4 FarPoint Spreadsheet 3.0 (OLEDB) FPSpreadADO.fpSpread.2 FarPoint Spreadsheet 3.5 (OLEDB) FPSpreadADO.fpSpread.3 FarPoint Spreadsheet 6 (OLEDB) FPSpreadADO.fpSpread.4 Microsoft Grid 1.0 MSGrid.Grid Microsoft DataBound Grid 5.0 MSDBGrid.DBGrid Microsoft Flex Grid 6.0 MSFlexGridLib.MSFlexGrid.1 Sheridan Data Grid 2.0 SSDataWidgets.SSDBGridCtrlApt.1 Sheridan Data Grid 3.1 SSDataWidgets.SSDBGridCtrlApt.3 Apex True DataBound Grid 5.0 TrueDBGrid50.TDBGrid Apex True DataBound Grid 6.0 TrueDBGrid60.TDBGrid Apex True OLE DB Grid 6.0 TrueOleDBGrid60.TDBGrid ActiveX Calendar Controls In addition to basic support of ActiveX properties and methods, QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Calendar controls: Name ProgId Microsoft Date and Time Picker Control 6.0 (SP4) MSComCtl2.DTPicker.2 Microsoft MonthView Control 6.0 (SP4) MSComCtl2.MonthView.2 www.ramupalanki.com
  • 16. For more QTP scripts, Log onto www.ramupalanki.com Multimedia Applications QTP6.5 supports testing on the following multimedia applications: • Microsoft Windows MediaPlayer controls, version 6.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. You can also test Macromedia Flash 6 clips containing only Flash 4 or 5 commands. Additional Environments QuickTest Professional add-ins support other environments such as Java, .NET Windows and Web Forms, SAP solutions, Oracle, Siebel, PeopleSoft, Web Services, and terminal emulator applications. For more information about QuickTest Professional add-ins, contact your sales representative or Mercury Interactive Customer Support. Note for QuickTest Professional 6.0 and earlier: Java support and Oracle support are now available as separate add-ins to QuickTest Professional 6.5 and are no longer part of the core product. QTP 8.0: www.ramupalanki.com
  • 17. For more QTP scripts, Log onto www.ramupalanki.com System Requirements To successfully install and run QTP8.0, you need the following minimum system requirements: IBM-PC or compatible with a Pentium II 266 MHz Computer/Processor: microprocessor (366 MHz recommended). Windows 2000-Service Pack 3 or Service Pack 4, Operating System: Windows XP-Service Pack 1, or Windows 2003 Server. Memory: 128 MB of RAM (256 MB recommended). 250 MB of free disk space for application files and folders, and an additional 120 MB of free disk space on the system disk (the disk on which the operating system Free Hard Disk is installed). Space: After Quick Test Professional is installed, 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. Microsoft Internet Explorer 5.5 Service Pack 2-6.0. Browser: Supported Add-ins The following external QuickTest 6.5.x add-ins are supported for use with QuickTest Professional 8.0: • Java Add-in 6.5 • Oracle Add-in 6.5 • PeopleSoft Add-in 6.5 • Terminal Emulator Add-in 6.5 • .NET Add-in 6.5.1 • SAP solutions Add-in 6.5.1 www.ramupalanki.com
  • 18. For more QTP scripts, Log onto www.ramupalanki.com Note: Siebel Add-in 6.5, the .NET Add-in 6.5, the Add-in for SAP solutions 6.5, or any 6.0 add-ins,cannot be used with QuickTest Professional 8.0.1 Supported Environments and Programs QuickTest Professional 8.0 supports creating, recording, and running tests or components using the environments and programs described below.  Standard Windows Applications 1.Win32 API 2.MFC  Visual Basic Applications Visual Basic 6.0 Note: Visual Basic .NET applications are supported by the QuickTest Professional .NET Add-in.  Browsers • Microsoft Internet Explorer 5.5 Service Pack 2-6.0 (required) • Netscape 6.1, Netscape 6.22, Netscape 6.23, Netscape 7.02, and Netscape 7.1 (optional) • AOL 8.0 and 9.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: www.ramupalanki.com
  • 19. For more QTP scripts, Log onto www.ramupalanki.com Name ProgId FarPoint Spreadsheet 2.5 FPSpread.Spread.1 FarPoint Spreadsheet 3.0 FPSpread.Spread.2 FarPoint Spreadsheet 3.5 FPSpread.Spread.3 FarPoint Spreadsheet 6.0 FPSpread.Spread.4 FarPoint Spreadsheet 3.0 (OLEDB) FPSpreadADO.fpSpread.2 FarPoint Spreadsheet 3.5 (OLEDB) FPSpreadADO.fpSpread.3 FarPoint Spreadsheet 6 (OLEDB) FPSpreadADO.fpSpread.4 Microsoft Grid 1.0 MSGrid.Grid Microsoft DataBound Grid 5.0 MSDBGrid.DBGrid Microsoft Flex Grid 6.0 MSFlexGridLib.MSFlexGrid.1 Sheridan Data Grid 2.0 SSDataWidgets.SSDBGridCtrlApt.1 Sheridan Data Grid 3.1 SSDataWidgets.SSDBGridCtrlApt.3 Apex True DataBound Grid 5.0 TrueDBGrid50.TDBGrid Apex True DataBound Grid 6.0 TrueDBGrid60.TDBGrid Apex True OLE DB Grid 6.0 TrueOleDBGrid60.TDBGrid ActiveX Calendar Controls In addition to built-in support for ActiveX properties and methods, QuickTest Professional supports context-sensitive recording and verification on the following ActiveX Calendar controls: Name ProgId Microsoft Date and Time Picker Control 6.0 (SP4) MSComCtl2.DTPicker.2 Microsoft MonthView Control 6.0 (SP4) MSComCtl2.MonthView.2 www.ramupalanki.com
  • 20. For more QTP scripts, Log onto www.ramupalanki.com Microsoft Excel When using Microsoft Excel files with QuickTest Professional 8.0(for example, to import or export data to or from the Data Table), you can work with Microsoft Excel 2000, 2002, 2003, and XP. Microsoft Query When using Microsoft Query with QuickTest Professional 8.0 (for example, for Database checkpoints), you can work with Microsoft Query 2000, 2002, 2003, and XP. Additional Environments QuickTest Professional add-ins support other environments such as Java, .NET Windows and Web Forms, SAP Solutions, Oracle, Siebel, PeopleSoft, Web Services, and terminal emulator applications. For more information on QuickTest Professional add-ins, contact your sales representative or Mercury Interactive Customer Support. www.ramupalanki.com
  • 21. For more QTP scripts, Log onto www.ramupalanki.com 3. Add-Ins 3.1 Types of Add-Ins QTP version Add-ins Java add-in 6.5 8.2 Oracle add-in 6.5 Siebel add-in 8.0 Terminal Emulator add-in 8.0 . Net add-in 8.2 Default Add-Ins: Active X Controls, Web &Visual Basic . Net add-in 6.5.1 8.0 Sap add-in 6.5.1 Java add-in 6.5 PeopleSoft add-in 6.5 Oracle add-in 6.5 Terminal Emulator add-in 6.5 Default Add-Ins: Active X Controls, Web &Visual Basic 6.5 . Net Web Java XML Default Add-Ins: Active X controls, Multimedia, Visual Basic, Web Note: Quick Test Professional Siebel add-in 6.5 and Web services add-in 6.0 cannot be used with Quick Test 8.0. • The add-ins for Quick Test Professional 6.0 cannot be used with Quick Test Professional 6.5. If you are using Quick Test Professional 6.5, you will need to get the 6.5 version of your add-in. www.ramupalanki.com
  • 22. For more QTP scripts, Log onto www.ramupalanki.com 3.2 Conditions for Add-ins 3.2.1 Java Add-In When testing Java applets in a Web browser, you must load the Web add-in as well as the Java Add-in, and use the Web tab of the Record and Run Settings Dialog box to specify your record and run preferences. To test Java applets or applications running on Netscape 4.x’s built-in JVM (not Java Plug-ins), confirm that the Netscape 4.x browser is already installed before installing the Quick Test Professional Java Add-in. When testing Java applets in a Web browser web Add-in as well as java add-in must be loaded .To create a checkpoint, parameterize a step, or to add a method from individual java applets, the Java Add-in must be loaded. 3.2.2 .Net Add-In The .Net add-in is required to support objects developed in .Net .In some cases, even though the application has been developed using .Net, when the page is sent to the browser, it is a plain HTML page. Quick Test Professional can recognize HTML controls like edit fields, buttons etc. without the .Net add-in. However, if a Web application contains complex controls like ActiveX or other controls developed in .Net like ASP.Net server controls, it is required to use the .Net add-in to achieve object recognition. 3.2.3 Sap Add-In The Sap add-in is required for all SAP applications. In SAP application Grid Tables, Status Bar messages, Labels can be identified only if SAP Add-in is installed. www.ramupalanki.com
  • 23. For more QTP scripts, Log onto www.ramupalanki.com 4. Conventions The Conventions for Naming for test cases, Scripts and Actions vary from Project to Project depending upon the Client. 4.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. 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. Consistency should be maintained in following the hierarchy of naming. Use Case Or Test Case Scenario For example: Example 1: Considering that Each Use case is associated with one Test case. If the name of the Use Case were UC_001 then the Test case name would be TC_001. Example 2: In the Unilever Automation Project, SAP transactions are divided into different modules, in those modules different transactions are grouped together as a scenario, so for writing the test case for a particular scenario naming convention used is module name followed by scenario name. For Module IMWM, if S014_01 is the scenario name, so name of the test case for the S014_01 scenario was given as IMWM_S014_01. 4.2 Script and Action Naming Conventions: Similar to the Test case naming, Script naming should be done consistently with clarity and traceability. Typically each Test Script is prepared corresponding to each Test Case. Every Test Case contains one or more Conditions. Each Condition can be represented by an action in the script. www.ramupalanki.com
  • 24. For more QTP scripts, Log onto www.ramupalanki.com Use Case Test Case Condition1 Condition2 Condition3 ……… Test Case Test script Condition 1 Action1 Condition2 Action2 Therefore for a Test Script corresponding to a Test Case named TC_001 would be QTS_001.The hierarchy should be maintained in case the use cases or test cases are nested. E.g.: TC_01_014 would have a QTP Test Script as QTS_01_014. Action Naming: Each Test Script can contain one or more Actions, with one or more actions representing a test Condition. Actions can be named in 2 ways: 1. Functionality of the Action 2. Hierarchy of the Action in the Test Script. 1. Functionality of the Action: Typically Actions are segregated by their functionality in the Test Script. Therefore it would be easier to understand the Action if the name of the action represents the Functionality. For E.g.: An Action written or recorded for logging the user should be named as Login or Authentication for easy understandability. An Action for booking tickets should be named as Book_Tickets An Action for exiting the application named as Exit. This also adds a huge advantage when the Actions are made reusable. Reusable Actions can be used between various scripts. When an Action is to be made reusable the action should be named as REUSE_(Action name). Example: REUSE_Login. www.ramupalanki.com
  • 25. For more QTP scripts, Log onto www.ramupalanki.com 2. Hierarchy of the Action in the Script: Since Actions are a part of the Test Script, for purpose of Clarity and tracking, Actions can be named as per Hierarchy. For e.g.: 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.3 Variables and Constants: QTP Scripts are in VB Script. Therefore, the naming conventions for variables can be followed alike VB Script Naming Conventions. General Conventions followed in VBScript are: Data Type Prefixes: By using data type prefixes, your variables always indicate what they are designed for. I'm using just six prefixes: Prefix Data Types Example b Boolean (true or false) bChecked = True d Date/time dStartTime = Now All numeric data types i iTax = iPrice * 0.076 (Byte, Integer, Currency, Long, Single, Double) o Objects Set oFile = Nothing s Strings sTitle = "Welcome!" u User interface elements uPara.style.display = "block" Constants Prefix: Usually there are only a handful of constants in any scripts. Indicating the data type therefore is less important for constants. Prefix letter c for all constants can be used. e.g. Const cTitle = "Welcome!" UDocument.title = cTitle www.ramupalanki.com
  • 26. For more QTP scripts, Log onto www.ramupalanki.com 4.4 DataSheet Naming and Parameter Naming Conventions: Every QTP Test Script contains 2 types of sheets. 1. Global data sheet 2. Local data sheets The Global data sheet, which is a common sheet for all the actions of the script, is named by default as dt_globalsheet. This can be renamed as Global for all the Scripts for consistency. Typically, Each Action in the Script contains one data sheet, which is local to the Action. This is by default, named after the Action to which it belongs. Therefore the name of the datasheet follows directly the name of the Action, which when named following its naming conventions, can be used efficiently for the data sheet too. 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). ‘In’ denoting that it’s an input parameter for the Test in whole. The name following IN should be a relevant name for the variable, denoting the purpose of its use. This should also comply with the standard variable naming conventions. Example: IN_bFlag, IN_iIncrement etc., b) Test Output Parameters: On the similar lines of Input Parameters, these should be named as OUT_(relevant variable name). OUT representing that it’s an output parameter. Example: OUT_sStatus. 2) Action Parameters a) Action Input Parameters: These are local to Action of a Test. These can be named as ACTIN_(variable name). ACTIN denoting that it’s an Action Input Parameter. Example: ACTIN_iResult b) Action Output Parameters: These could be named as ACTOUT_(var name). www.ramupalanki.com
  • 27. For more QTP scripts, Log onto www.ramupalanki.com Example: ACTOUT_bFlag 3) Environment Variables: Environment variables are either built-in or User defined. Built-in variables cannot be declared named by the user, so their naming convention is not discussed. User Defined Environment Variables are either Internal or External. Internal Variables: ENV_INT_(variable name) External Variables: ENV_EXT_(Variable name) 4.5 Function Naming Conventions Functions should be named as Func_(name). This can provide clarity and difference between a Reusable Action and a Function that can be used within Actions. Example: Func_Save , Func_Add www.ramupalanki.com
  • 28. For more QTP scripts, Log onto www.ramupalanki.com 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 www.ramupalanki.com
  • 29. For more QTP scripts, Log onto www.ramupalanki.com 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. www.ramupalanki.com
  • 30. For more QTP scripts, Log onto www.ramupalanki.com 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. www.ramupalanki.com
  • 31. For more QTP scripts, Log onto www.ramupalanki.com The settings can be changed by going to Test>Settings>Resources>Object Repository Type In the Per-Action mode, 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.In the Shared mode, the user may choose a location to save the shared object repository files for all the tests. All the Objects recorded during a test,and their properties can be seen and manipulated in the Tools>Object Repository.There are provisions in this Object Repository Dialog box to add new objects,spy objects, find and replace property values etc. www.ramupalanki.com
  • 32. For more QTP scripts, Log onto www.ramupalanki.com The First Section of Object Repository Dialog Box contains provisions to a. Add Objects : A Button to add new objects to the repository. b. Highlight: To highlight the object selected in the repository, when the application is open. c. Object Spy: To Spy any Object, to see its Properties. d. Export: To Export any objects to an outside location. The second section of the dialog box contains provision to Find, Replace, Add, and Remove the properties of an object in the Repository also set any default values for the properties. 5.5 Expert View While recording Tests in QTP, there are 3 important views that enable us to understand clearly, the various representations of the Script. They are a. Expert View b. Keyword View: Hierarchical Representation of Actions www.ramupalanki.com
  • 33. For more QTP scripts, Log onto www.ramupalanki.com c. Active Screen View: Pictorial view of the currently active Screen. In the Expert View, 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. For each object and method in an Expert View statement, a corresponding row exists in the Keyword View and a corresponding Active Screen in the Active Screen view, which enables easy traceability. Fig: Active Screen Component corresponding to Expert View Statement www.ramupalanki.com
  • 34. For more QTP scripts, Log onto www.ramupalanki.com Fig: Keyword view and Active Screen view corresponding to one expert view statement 5.5.1 Step Generator: If the user is familiar with VBScript, the user can add and update statements and enhance the tests and components with programming. After the test or an Action is recorded, its power and flexibility can be increased by adding recordable and non-recordable VBScript statements as required for tasks like Check Points,Datatables etc.,.These additional steps can be added either manually or using Insert>Step >Step Generator .whenever a step is added to a script, then any Syntax errors of the step can be Identified in its Keyword view. www.ramupalanki.com
  • 35. For more QTP scripts, Log onto www.ramupalanki.com 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.The generated step gets added at the position of cursor in the expert view. 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. 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, VBScript functions, and internal script functions 5.6 Setting related to the Application Used: The different kind of Applications that can be tested using QTP are windows applications,web based(java and .Net),SAP,Oracle etc.Apart from the windows www.ramupalanki.com
  • 36. For more QTP scripts, Log onto www.ramupalanki.com applications using MFC and simple web applications(which can be run with default add- ins), rest all applications require a special Add-in to be purchased to do the testing.Each Add-in which is bought and installed, results in a new tab in all the setting dialog boxes , using which various setting options can be chosen.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 www.ramupalanki.com
  • 37. For more QTP scripts, Log onto www.ramupalanki.com Fig: Record and Run Settings with a SAP Add-in. For detailed information of the settings of the tabs other than the special tabs refer Record and run settings. www.ramupalanki.com
  • 38. For more QTP scripts, Log onto www.ramupalanki.com 6. Objects 6.1 Objects Objects are the things which contains different properties and methods. For Example: Window is said to be an object which consists of properties such as Exist, GetROProperty and methods such as ChildObjects, Activate, maximize, minimize etc. Property: Property describes about the object defined, each object has different properties, which is necessary to describe the object, which differentiates the given object with other objects. For example: If we take a window object, we first have to define to which class it belongs to which is one of the property, it belongs to a window class. Exist is a property which is common to many objects which returns true if that object exists. Methods: Methods are functions, which are used for changing the properties of the object that is in order to manipulate with the object properties we use. For example: If we take a window object, Activate is a method used to activate the window object, thus by using Activate method Activate property of the present window object is set to true, thus the window object will be activated if not in activated mode. www.ramupalanki.com
  • 39. For more QTP scripts, Log onto www.ramupalanki.com Sample for Object hierarchy: Method for “WinEdit” Object “Dialog” Object Child Object for “Dialog” Object In the above sample of code, there are two main Objects, one is Dialog and the other is Window object. This objects contain child objects, For Dialog object which is named as “Login” has WinEdit object with name as “Agent Name:” as childobject, here Set is the method used to set a text into the WinEdit object. Dialog Parent Object named as “Login” Child Object WinEdit named as “Agent www.ramupalanki.com Name:”
  • 40. For more QTP scripts, Log onto www.ramupalanki.com “Set” is the method associated with “WinEdit” object 7. Data Table In QTP scripting there are many objects that are used, One of the Objects used in QTP scripting is DataTable Object. 7.1 Datatable Object and related Functions: Description Basic use of Datatable object is to create an object for adding, deleting, updating data of an excel sheet used. Main functions of the datatable object: • Importsheet : This function is used to Import sheet into the script, so that all the data in the imported sheet can be used in the script. Syntax: Datatable.Importsheet(“nameofExcelfilewithpath”, “nameofthesourcesheet”, “nameofthedestinationsheet”) • Exportsheet : This function is used to Export sheet from the script, all the data including output values are stored in the default sheet for the action, this sheet is exported and stored in a specified location using this function. Syntax: Datatable.Exportsheet(“nameofExcelfilewithpath”, “Nameofthesheet”) • Addsheet : Used for adding a sheet into the script file. • GetRowCount: This function is used to get the no of rows in a particular sheet. Syntax: www.ramupalanki.com
  • 41. For more QTP scripts, Log onto www.ramupalanki.com Datatable.AddSheet(“Sheetname”).GetRowCount • GetCurrentRow: This function is used to get the current row of a particular sheet. When an action is run by using run setting as “run on all rows”, that action will run as many times as the number of rows in the excel sheet of the action, in order to find the row for which action is running currently we use GetCurrentRow function. Syntax: Datatable.GetSheet(“Sheetname”).GetCurrentRow 7.2 Organizing Data Sheets for Global & Local variables Description There are two types of sheets in any QTP Script, they are Globalsheet Localsheet Globalsheet: Globalsheet in any script is unique, Globalsheet is used in order to store values in the sheet and the values stored in Globalsheet can be used in all the actions. For storing a value in the global sheet we use the following function: Datatable.Value(“Fieldname”,”Global”) = Value For using the values from the global sheet we use the following function: Value = Datatable.Value(“Fieldname”,”Global”) Localsheet: Each and every action in the script will have its own Localsheet, name of the Localsheet of a particular action is same as the action name. For using the data from the Local sheet we use following function: Datatable.Value(“Fieldname”,dtlocalsheet) www.ramupalanki.com
  • 42. For more QTP scripts, Log onto www.ramupalanki.com Or Datatable.Value(“Fieldname”,”Sheetname”) 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.3 Parameterizing using Data driven Wizard Description The Data Driver enables you to quickly parameterize several (or all) property values for test objects, checkpoints, and/or method arguments containing the same constant value within a given action. You can choose to replace all occurrences of a selected constant value with a parameter, in the same way that you can use a Find and Replace All operation instead of a step-by-step Find and Replace process. QuickTest can also show you each occurrence of the constant so that you can decide whether or not to parameterize the value. www.ramupalanki.com
  • 43. For more QTP scripts, Log onto www.ramupalanki.com If any property of an object is taken, that property can be parameterized using Data driven Wizard, 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.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").WinEdit("Agent Name:").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. • There will be two options to be selected as given below: www.ramupalanki.com
  • 44. For more QTP scripts, Log onto www.ramupalanki.com Step-by-step Parameterization: Enables you to view the current values of each step containing the selected value. For each step, you can choose whether or not to parameterize the value, and if so, which parameterization options you want to use, the Next button is enabled when you select this option, this will enable us to select an other instance of the constant selected and parameterize that instant, it will continue the same process till all the instances of the given value are done. www.ramupalanki.com
  • 45. For more QTP scripts, Log onto www.ramupalanki.com Parameterize all: Enables you to parameterize all occurrences of the selected value throughout the action. When you select this option the Parameter details area is enabled. The Finish button is enabled when you select this option. www.ramupalanki.com
  • 46. For more QTP scripts, Log onto www.ramupalanki.com Here Parameter tab can be selected using the button given at the “Parameter” radio button, and in the next screen select the datatable Field from where the property for which the value belongs is parametererized, click on “Finish” button thus all the instances of the value selected for parameterization will be parameterized. 7.4 Importing and Exporting Datasheets: Description Importing and Exporting of Datasheets are used for reading, writing and manipulating the data in an excel sheet. Importing Datasheet: Description Imports a sheet of a specified file to a specified sheet in the run-time Data Table. The data in the imported sheet replaces the data in the destination sheet (see SheetDest argument). www.ramupalanki.com
  • 47. For more QTP scripts, Log onto www.ramupalanki.com Note: All the fields in the imported sheets should match with the data used in the script. There are two functions for Importing, Importing the whole excel file and Importing the sheets in the file. Function for Importing the whole Excel file: Imports the file into the script with all the sheets which are there in the excel file. Note: Sheets in the excel file should match with the Actions in the script to use the data efficiently, since action name and corresponding sheet name should be same. Syntax: Import “filenamewithpath” Function for Importing the sheets from the excel file: Imports the specified sheet into the script. Syntax: Importsheet “filenamewithpath”,”sourcesheetname”, ”destinationsheetname” Exporting Datasheet: Description Exports a specified sheet of the run-time Data Table to the specified file. • If the specified file does not exist, a new file is created and the specified sheet is saved. • If the current file exists, but the file does not contain a sheet with the specified sheet name, the sheet is inserted as the last sheet of the file. • If the current file exists and the file contains the specified sheet, the exported sheet overwrites the existing sheet. Same as Importing, There are two functions for Exporting, 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. www.ramupalanki.com
  • 48. For more QTP scripts, Log onto www.ramupalanki.com Syntax: Export “filenamewithpath” Function for Exporting the sheets from the excel file: Exports the specified sheet into the script. Syntax: Exportsheet “filenamewithpath”,”sourcesheetname”, ”destinationsheetname” www.ramupalanki.com
  • 49. For more QTP scripts, Log onto www.ramupalanki.com 8. Actions 8.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, to run iterations on all rows in the Data Table, or to run iterations only for certain rows in the Data Table. www.ramupalanki.com
  • 50. For more QTP scripts, Log onto www.ramupalanki.com 8.2 Iterations using rows The Run tab includes the following options: Option Description Runs the called action only once, using the row in the action's data sheet that corresponds to the current global iteration number. If the action's data sheet contains fewer rows than the global sheet, the last row of the action's data sheet is used for each subsequent test iteration. For example, suppose an action's data sheet has two rows and the global sheet has four rows. If you choose to run one iteration only for the action and you choose to run iterations on all rows of the Run one global data sheet, then during each iteration of the test, this action iteration will run only one iteration. The data that the action parameters use only during each repetition of the test are based on the iteration number for the test. During the first iteration of the test, Data Table parameters in the action take data from the first row of the action's data sheet. In the second iteration of the test, Data Table parameters in the action take data from the second row of the action's data sheet. In the third and subsequent iterations of the test, the Data Table parameters in the action continue to take data from the second i.e. the last row of the action's data sheet. Run on all Runs the called action with the number of iterations according to the rows number of rows in the action's Data Table. Run from Runs the called action with the number of iterations according to the row __ to specified row range. 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. www.ramupalanki.com
  • 51. For more QTP scripts, Log onto www.ramupalanki.com 8.3 Action Template Creating an Action Template If you want to include one or more statements in every new action in your test, you can create an action template. For example, if you always enter your name as the author of an action, you can add this comment line to your action template. An action template applies only to actions created on your computer. To create an action template: 1. Create a text file containing the comments, function calls, 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. 2. Save the text file as ActionTemplate.mst in your <QuickTest Installation Folder>dat folder. All new actions you create contain the script lines from the action template. Only the file name ActionTemplate.mst is recognized as an action template. ActionTemplate.mst To view the Action template refer to 8.4 Script Startup • Check for the required add-ins for an application. • Include action template for every test containing script id, Action name, Action Description, Recovery scenario used etc. • Every action, scenario must be specified with an appropriate name. • Check for mandatory input fields for all iterations in the datasheets that are being imported. Example: The Resources tab of the Test Settings dialog box can be used to associate specific files with the test, such as Data Table files. The option area Other location instructs Quick Test to use data stored in the specified Data Table location. The Data Table can be any Microsoft Excel (.xls) file. www.ramupalanki.com
  • 52. For more QTP scripts, Log onto www.ramupalanki.com 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. For further details refer to QTP test settings doc. 8.5 Splitting Actions, Re-usable Actions, Internal/External Actions Actions help divide your test into logical units, specific activities that you perform in your application. www.ramupalanki.com
  • 53. For more QTP scripts, Log onto www.ramupalanki.com A test is made up of calls to actions. When you create a new test, it contains a call to a single action or create tests that call multiple actions by inserting calls to them, to make the design more modular and efficient tests. There are three kinds of actions: • 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. • external action—a reusable action stored with another test. External actions are read-only in the calling test. They can be modified only in the test with which they are stored. • Non-resuable-actions —an action that can be called only in the test with which it is stored, and can be called only once. For further details on creation & splitting of actions refer to Actions. www.ramupalanki.com
  • 54. For more QTP scripts, Log onto www.ramupalanki.com 9. Object Repository 9.1 Per Action/Shared Object Repository: Setting the Shared /per action Object Repository option To set only one test to use the Shared Object Repository option: 1. Click the "New" button or go to File -> New to open a new test. 2. Go to Test -> Settings. 3. Select the Resources tab. 4. In the Object repository type box, select one of the options: www.ramupalanki.com
  • 55. For more QTP scripts, Log onto www.ramupalanki.com • Select "Per-action" to set the Object Repository mode for your test to the Object Repository per action mode. Below are some of the factors based on which Per Action option is selected • Whenever there are no common objects across transactions • Ease of building object repository. • 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. 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. If you selected Shared in step 4, specify the Shared Object Repository file you want to use as the test's Object Repository file. To specify a file, enter the Object Repository file name or click the "Browse" button and select a resource file (*.tsr) from the Open dialog box. To create a new Shared Object Repository file, enter a new file name in the Shared box. Note: These steps need to be done in a new script. Once you have modified the script, you will not be able to change the option. To set all new scripts to use a Shared Object Repository: For Quick Test Professional 6.5 and above 1. Click the New button or go to File -> New to open a new test. 2. Go to Test -> Settings. 3. Select the Resources tab. 4. Select the Shared option for the "Object-repository type". 5. Specify the Shared Object Repository file you want to use as the test's Object Repository file. To specify a file, enter the Object Repository file name or click the ellipse button <...> and select a resource file (*.tsr) from the Open dialog box. To create a new Shared Object Repository file, enter a new file name and path in the Shared box. 6. Click the "Set as Default" button. 7. Click <Apply> and <OK>. www.ramupalanki.com
  • 56. For more QTP scripts, Log onto www.ramupalanki.com 9.2 Merging of two object repositories: General: The Object Repository File Merge Utility allows users to merge object repository files into a single file. This utility is intended for an advanced user that builds powerful tests. 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. Conflicts: The implementation of the merge algorithm is quite simple when the object repository files have different objects in them, or if all objects had only exact replicas in other files. Due to the nature of the operation it is often not the case. For example, if we try to merge two object repositories from tests that were recorded at different time points, between which some test objects properties have changed (e.g. whether a button is enabled) then the same object exists in the two repositories with different properties. We call this a description conflict as the two objects have the same name, but different descriptive properties. It can also be that the user has decided to modify the automatically assigned logical name of an object (for example, in order to create a shorter name) in one repository but not in the other. In this case, two objects will exist with different logical names, but with the same descriptive properties. We call this a name conflict. Resolving Conflicts: It is not trivial to identify and handle conflicting objects. The user might want to merge two objects that were not initially the same, or decide to keep two objects that for the inexperienced eye would seem identical. For example, recording on web browsers would likely generate identical logical names for browsers that have nothing in common. It is also likely that if the text on a button has changed, new tests would record a new logical name for it, even though the object behavior has not changed. It is therefore possible to either keep the two objects (and their subtrees) separated, to assume that the two objects are actually the same object, or to ignore one of the conflicting object. We will discuss these choices later in detail. Note: The Merge Utility works only on machines where QTP8.0 is installed. www.ramupalanki.com
  • 57. For more QTP scripts, Log onto www.ramupalanki.com Merge Object Repositories Utility Main Window: This utility is designed to supply simple access to the functionality implemented by the ObjectRepositoryMgr COM component. As the operation is not trivial, the UI has many options to select, so we will discuss the different options in detail. For different options of Merging refer to Merging of Object Repositories. 9.3 Limitations: 1. Mercury Interactive recommends that you keep the Object Repository under 1 MB and perform regular backups. If the size crosses more than 1MB loading of object repository takes lot of time . 2. The limitation on the number of Actions is 255. 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 www.ramupalanki.com
  • 58. For more QTP scripts, Log onto www.ramupalanki.com 255 Actions per test. You may be able to add additional Actions after reaching the 255 "limit", however those Actions will not be able to access a local data sheet. Note: If you are calling reusable Actions, you may be able to have more than 255 Actions within the script. This can be accomplished if you are calling the same Action more than one time within the script. The data sheet for the Action will only be loaded once. This applies to "call to" Actions only. Example: In a new script, insert a "call to" a reusable Action. When the Action is added to the script, you will see the data sheet added to the data table. Insert another "call to" to the same Action. The data sheet will not be added again. www.ramupalanki.com
  • 59. For more QTP scripts, Log onto www.ramupalanki.com 10. Variables In QTP scripting there are mainly 3 types of variable that we use. They are: • Action Parameters. • Environment Variables. • VB Variables, which we declare in the script. 10.1 Action Parameters Action parameters enable you to transfer values between actions and their nested actions in your test, from your test to a top-level action, or from a step in a top- level action back to the script or action that ran (called) your test. For example, you can output a value from a step in a nested action and store it in an output action parameter, and then use that value as input in a later step in the calling parent action. 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. 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. You can specify input parameters for an action so it can receive input values from elsewhere in the test. Input values for an action 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). You can also specify output parameters for an action, so that it can output values for use later in the test, or pass values back to the application that ran (called) the test. 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. 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). You can specify output parameters for an action, so that it can return values for use later in the test. For each input or output action parameter, you define a name and a type. You can also specify a default value for each action input parameter, or you can use the default value that QuickTest provides for the parameter value type that you choose. 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. You can define, modify, and delete input and output parameters in the Parameters tab of the Action Properties dialog box. www.ramupalanki.com
  • 60. For more QTP scripts, Log onto www.ramupalanki.com To add a new input or output action parameter: 1. Click the Add button next to the Input parameters or Output parameters lists to add a new parameter to the appropriate list. A row for the new parameter is added to the relevant list. 2. Click in the Name box and enter a name for the parameter. 3. Select the value type for the parameter in the Type box. You can select one of the following types: o String—A character string enclosed within a pair of quotation marks, for example, "New York". If you enter a value and do not include the quotation marks, QuickTest adds them automatically when the value is inserted in the script during the test run. The default value is an empty string. o Boolean—A true or false value. If you select a Boolean value type, you can click in the Default Value column and click the arrow to select a True or False value. The default value is True. o Date—A date string, for example, 3/2/2005. If you select a Date value type, you can click in the Default Value column and click the arrow to open a calendar from which you can select a date. The default value is today's date. www.ramupalanki.com
  • 61. For more QTP scripts, Log onto www.ramupalanki.com o Number—Any positive or negative number. The default value is 0. o Password—An encrypted password value. If you select a Password value type, the password characters are masked when you enter the password in the Default Value field. The default value is an empty string. o Any—A variant value type, which accepts any of the above value types. Note that if you select the Any value type, you must specify the value in the format that is required in the location where you intend to use the value. For example, if you intend to use the value later as a string, you must enclose it in quotation marks. When you specify a value of Any type, QuickTest checks whether it is a number. If the value is not a number, QuickTest automatically encloses it in quotation marks. If you are editing an existing value, QuickTest automatically encloses it in quotation marks if the previous value had quotation marks. The default value is an empty string. 4. If you are defining an input action parameter, 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. The default value is required so that you can run the action without receiving parameter values from elsewhere in the test. 5. If you wish, click in the Description box, then enter a description of the parameter, for example, the purpose of the parameter in the action. To modify an existing action parameter: 1. Select the parameter you want to modify from the Input parameters or Output parameters list. 2. Modify the values as necessary in the edit boxes of the parameter row. To delete an existing action parameter: 1. Select the parameter you want to delete from the Input parameters or Output parameters list. 2. Click the Delete button . The parameter is removed from the list. 10.2 Test Parameters In the Parameters tab of Test Settings, you can define input parameters that pass values into your test or component and output parameters that pass values from your test or www.ramupalanki.com
  • 62. For more QTP scripts, Log onto www.ramupalanki.com component to external sources. You can also use the Parameters tab to modify or delete existing test or component parameters 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. • 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. You can add and delete input and output parameters for your test or component using the parameter control buttons: www.ramupalanki.com
  • 63. For more QTP scripts, Log onto www.ramupalanki.com Option Description Adds a parameter to the appropriate parameter list. Enter a name for the new parameter and select the parameter type. You can enter a description for the parameter, for example, the purpose of the parameter in the component. If you are defining an input parameter, enter a default value for the parameter in the Default Value column. You define test or component parameters in the same way you define action parameters. Removes the selected parameter from the test or component. Defining Values for Input Parameters When the test or component runs, 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. When you run a test or business component from QuickTest, input parameter values for tests and components are taken from in the Input Parameters tab of the Run dialog box. Using Test or Component Parameters Once you have defined test or component parameters, you insert them in your test or component by specifying the test or component parameter name with the Parameter reserved object, in the format: Parameter("ParameterName"). 10.3 Environment Variables QuickTest can insert a value from the Environment variable list, which is a list of variables and corresponding values that can be accessed from your test. Throughout the test run, the value of an environment variable remains the same, regardless of the number of iterations, unless you change the value of the variable programmatically in your script. There are three types of environment variables: • User-Defined Internal—variables that you define within the test. These variables are saved with the test and are accessible only within the test in which they were defined. www.ramupalanki.com
  • 64. For more QTP scripts, Log onto www.ramupalanki.com You can create or modify internal, user-defined environment variables for your test in the Environment tab of the Test Settings dialog box or in the Parameter Options dialog box. Tip: You can also create environment output values, which retrieve values during the test run and output them to internal environment variable parameters for use in your test. • User-Defined External—variables that you predefine in the active external environment variables file. You can create as many files as you want and select an appropriate file for each test, or change files for each test run. Note that external environment variable values are designated as read-only within the test. • Built-in—variables that represent information about the test and the computer on which the test is run, such as Test path and Operating system. These variables are accessible from all tests, and are designated as read- only. 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. You should not use the names of these variables for any other purpose. 10.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 subsequently retrieve these values and use them as input at a different stage in the run session. You can pass variables from one action to another by setting Action Call Parameter Values. 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. You can also parameterize the value used for a particular input action parameter using any available parameter type. The actual input and output action parameters that an action can receive or return, and their types, are defined in the Action Properties dialog box. If you do not set a value for an input action parameter in the Action Call Properties dialog box, the default value that is specified in the Action Properties dialog box is used. www.ramupalanki.com
  • 65. For more QTP scripts, Log onto www.ramupalanki.com You can specify a location in which to store the output action parameter values, which can be used in the called action. To specify a location in which to store an output action parameter value: 1. In the Output parameters area, click in the Store In box for the parameter and enter a variable name. www.ramupalanki.com
  • 66. For more QTP scripts, Log onto www.ramupalanki.com If we choose variable to store the value, then the value is stored in a run- time variable for the duration of the run session. You can accept the default name assigned to the variable or enter a different variable name. Alternatively, 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. You can select to store the value in a test or action parameter, a Data Table parameter, or an environment parameter. 2. Repeat this procedure for each output action parameter value in the list. 10.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. If you change the action parameters defined for an action, and then view the action properties for a call to that same action in a different part of the test, you can see the action parameters have changed. However, 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. When you insert a call to a copy of an action, the copy of the action is inserted with the action parameters and action call parameter values that were www.ramupalanki.com
  • 67. For more QTP scripts, Log onto www.ramupalanki.com defined for the action you copied. When you split an action, the action parameters are copied to both actions. The action call values for the second action are taken from the default values of that action's parameters. Environment variables can be accessed from your test. Throughout the test run, the value of an environment variable remains the same, regardless of the number of iterations, unless you change the value of the variable programmatically in your script. There are three types of environment variables:  User-Defined Internal—variables that you define within the test. These variables are saved with the test and are accessible only within the test in which they were defined. You can create or modify internal, user-defined environment variables for your test in the Environment tab of the Test Settings dialog box or in the Parameter Options dialog box.  User-Defined External—variables that you predefine in the active external environment variables file. You can create as many files as you want and select an appropriate file for each test, or change files for each test run. Note that external environment variable values are designated as read-only within the test.  Built-in—variables that represent information about the test and the computer on which the test is run, such as Test path and Operating system. These variables are accessible from all tests, and are designated as read- only. www.ramupalanki.com
  • 68. For more QTP scripts, Log onto www.ramupalanki.com 11. Check Points A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. 11.1 Types of Checkpoints In QTP the following types of checkpoints can be inserted to check various objects in a Web site or application. • Standard Checkpoint checks the property value of an object in your application or Web page. The standard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists, etc. For example, you can check that a radio button is activated after it is selected or you can check the value of an edit field. Note: Standard checkpoints are supported for all add-in environments • Image Checkpoint checks the value of an image in the application or Web page. For example, we can check that a selected image's source file is correct. Note: Image checkpoint can be created by inserting a standard checkpoint on an image object. Image checkpoints are supported only for the Web environment • Bitmap Checkpoint checks an area of a Web page or an application as a bitmap. For example, consider a Web site that can display a map of a city the user specifies. The map has control keys for zooming. We can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, 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. For example, suppose an application or Web site contains a table listing all available flights from New York to San Francisco. You can add a table checkpoint to check that the time of the first flight in the table is correct. www.ramupalanki.com
  • 69. For more QTP scripts, Log onto www.ramupalanki.com 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. • Text Checkpoint checks that a text string is displayed in the appropriate place in the application or a Web page. For example, consider an application or Web page that displays the sentence Flight departing from New York to San Francisco. We can create a text checkpoint that checks that the words "New York" are displayed between "Flight departing from" and "to San Francisco". 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, according to specified criteria. For example, suppose your Visual Basic application has a button that says View Doc <Num>, where <Num> is replaced by the four digit code entered in a form elsewhere in the application. 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. Text area checkpoints are supported for Standard Windows, Visual Basic, and ActiveX add-in environments Text area checkpoints are also supported for some external add-in environments. • Accessibility Checkpoint identifies areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. For example, guideline 1.1 of the W3C Web Content Accessibility Guidelines requires you to provide a text equivalent for every non-text element. You can add an Alt property check to check whether objects that require the Alt property under this guideline, do in fact have this tag. Accessibility checkpoints are supported for the Web environment • Page Checkpoint checks the characteristics of a Web page. For example, you can check how long a Web page takes to load or whether a Web page contains broken links. Note: You create a page checkpoint by inserting a standard checkpoint on a page object. Page checkpoints are supported for the Web environment www.ramupalanki.com
  • 70. For more QTP scripts, Log onto www.ramupalanki.com • Database Checkpoint checks the contents of a database accessed by your Web site. For example, you can use a database checkpoint to check the contents of a database containing flight information for your Web site. Database checkpoints are supported by all environments. • XML Checkpoint checks the data content of XML documents in XML files or XML documents in Web pages and frames. XML checkpoints (Web page/frame) are supported for the Web environment; 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. • To add checkpoints while recording • To add a checkpoint while editing the test For more information refer to Checkpoints 11.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 www.ramupalanki.com
  • 71. For more QTP scripts, Log onto www.ramupalanki.com Adding output values in a test in QTP • 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. Note: If you insert an output value on a Web page, the Page Output Value Properties dialog box opens. This dialog except that it contains two additional option areas, HTML verification and All objects in page. These options are relevant only for checkpoints and are disabled when defining output values. The output values can be output to either of these locations: www.ramupalanki.com
  • 72. For more QTP scripts, Log onto www.ramupalanki.com • GlobalLocal Sheet • Environment variables • ActionTest Parameter. This option is given in the output options dialog box 12. Reusable Library Description www.ramupalanki.com
  • 73. For more QTP scripts, Log onto www.ramupalanki.com When forming a new product the traditional engineer can take advantage of ready-made subassemblies. To the test engineer, reusable software components offer the same possibilities; the same components can be incorporated into many whole new systems, thus saving the considerable time and effort it can take to generate new software. Starting with an introduction to software reuse and a discussion of its feasibility, the authors go on to consider how the components that may be found could be used. The reusable library was designed with reuse very much in mind, making it essentially a small, but invaluable, library. 12.1 Introduction In QTP we can create VBScript library files containing VBScript functions, subroutines, classes, modules, etc., and then associate the files with our test. We can call any VBScript function, subroutine, etc., contained within any library file that is associated with our test. Any text file written in standard VBScript syntax can act as a library file. a) Functions i. Built-In ii. User defined We can specify the default library files for all new tests in the Test Settings dialog box (Test > Settings > Resources tab). We can also edit the list of associated library files for an existing test in the Test Settings dialog box. Note that once a test is created, 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. Changes to the default library files list in the Test. 12.2 How to establish a Reusable Library www.ramupalanki.com
  • 74. For more QTP scripts, Log onto www.ramupalanki.com a. Defining Resource Settings for Your Test We can use the Resources tab of the Test Settings dialog box to associate specific files with your test, such as VBScript library files and Data Table files, and to specify the object repository mode and file to use for our test. We can also set the currently associated library files and object repository settings as the default settings for all new tests. b. Executing Externally-Defined Functions from Your Test We can create a VBScript file and call its functions, subroutines, classes, etc., from an action in your test or from an associated library file by inserting an ExecuteFile statement in our action or library file. When we run our test, 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. www.ramupalanki.com
  • 75. For more QTP scripts, Log onto www.ramupalanki.com To execute an externally-defined function: 1. Create a VBScript file using standard VBScript syntax. 2. Store the file in any folder that you can access from the machine running your test. 3. 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. 1. Use the functions, subroutines, classes, etc., from the specified VBScript file as necessary in your action or within other functions in an associated library file. 12.3 How to use this Reusable Library. 13. Regular Expressions 13.1 Description www.ramupalanki.com
  • 76. For more QTP scripts, Log onto www.ramupalanki.com While creating checkpoints we have an option only to search or check for a specific text string or a specific value of a property. To increase the flexibility and adaptability of the tests we use regular expressions. Regular Expressions enable Quick Test to identify objects and text strings with varying values. A regular expression is a string that specifies a complex search phrase. By using special characters we define the conditions of the search. The most common expressions that can be used to create regular expressions are: 1. Using the Backslash Character A backslash () instructs Quick Test to treat the next character as a literal character, if it is otherwise a special character. The backslash () can also instruct Quick Test to recognize certain ordinary characters as special characters. For example, consider a Web site called: mercurytours.mercuryinteractive.com The period would be mistaken as an indication of a regular expression. To indicate that the period is not part of a regular expression, you would write it as follows: mercurytours.mercuryinteractive.com 2. Matching Any Single Character A period (.) instructs Quick Test to search for any single character (except for n). For example: welcome. matches welcomes, welcomed, or welcome followed by a space or any other single character. A series of periods indicates the same number of unspecified characters. To match any single character including n, enter: (.|n) 3. Matching Any Single Character in a List Square brackets instruct QuickTest to search for any single character within a list of characters. For example, to search for the date 1967, 1968, or 1969, write: 196[789] 4. Matching Any Single Character Not in a List www.ramupalanki.com