QTP Training

Internal

On Premise Suite Test Center TIP CORE ECF India

Agenda

Introduction Modes of Recording Object Repository Actions, Parameterizations, Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary

Internal

Agenda for the Day 1

Agenda
Expectation Setting Introduction

Time
8:30 A.M – 9:00 A.M 9:00 A.M – 9:45 A.M

Modes of recording
Break Exercise Lunch Object Repository Exercise Break Actions, Parameterizations, Paths & Conditions Exercise
© SAP AG 2009. All rights reserved. / Page 3

9:45 A.M – 10:45 A.M
10:45 A.M – 11:00 A.M 11:00 A.M – 12:00 P.M 12:00 P.M – 12:45 P.M 12:45 P.M – 01:30 P.M 01:30 P.M –02:30 P.M 02:30 P.M –02:45 P.M 02:45 P.M –03:45 P.M 03:45 P.M – 5:00 P.M
Internal

Agenda for the Day 2

Agenda
Function Library Break

Time
8:30 A.M – 10:30 A.M 10:30 A.M – 10:45 A.M

Exercise
Lunch Check Points Exercise Break Descriptive Programming Exercise Glossary

10:45 A.M – 12:00 P.M
12:00 P.M – 12:45 P.M 12:45 P.M – 1:45 P.M 1:45 P.M – 2:45 P.M 2:45 P.M – 3:00 P.M 3:00 P.M – 3:45 P.M 3:45 P.M – 4:45 P.M 4:45 P.M – 5:00 P.M

© SAP AG 2009. All rights reserved. / Page 4

Internal

Agenda

Introduction Modes of Recording Object Repository Actions, Parameterizations, Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary

Internal

HP Quick Test Professional

To reduce the time and costs associated with application testing, you need a solution that offers functionality across most of the environments and business processes….

© SAP AG 2009. All rights reserved. / Page 6

Internal

Power Builder Web  Web Applications.QTP Environment and Add Ins Windows  C++. ActiveX We have different sets of add ins for all the above mentioned technologies to support object manipulation in QTP © SAP AG 2009. Oracle. AOL. Web services. Java. Flash Netscape. All rights reserved. Firefox Browsers  Other technologies  SAP. . / Page 7 Internal . Siebel. Visual Basic.NET. IE. Peoplesoft.

0.5 Enables collaboration among workgroups with shared function libraries and robust object management Manages multiple object repositories with ease to facilitate building automated frameworks and libraries Point-and-check interface for accessing & interacting with the components of the application under test   © SAP AG 2009.1. 8. 8.2. 9.2.9.5.9.Key Features and Benefits      QTP provides record and playback of events Uses VBScript as the scripting Language Provides Keyword View and Expert View to view test cases Previous version of QTP: 6.0. / Page 8 Internal .1. All rights reserved. 9. 8.

/ Page 9 Internal .Key Features and Benefits  Has an Icon-Based test tree in which each branch represents a step in the business process QTP implements the following Checkpoints in the Scripts:        Standard Checkpoint Text Checkpoint Text Area Checkpoint Bitmap Checkpoint Database Checkpoint XML Checkpoint  Provides three modes of Recording depending on the types of UI Screens and objects:    Normal Analog Low level © SAP AG 2009. All rights reserved.

All rights reserved.Toolbars Test toolbar  contains buttons to assist you in the testing process (e.) Debug toolbar  contains buttons to assist you in debugging your test Action toolbar  contains buttons and a list of actions.g. run. record. / Page 10 Internal .. enabling you to view the details of an individual action or the entire test flow Test pane:  contains two tabs to view your test—the Keyword View and the Expert View Information  contains the syntax errors or any other relevant information about the Test Data Table  contains two or more tabs to assist you in parameterizing your test—Global and one tab for each Action © SAP AG 2009.

QTP Screen (Expert View)… Toolbars DataTable and Resources Active Screen Information Pane © SAP AG 2009. All rights reserved. / Page 11 Internal .

/ Page 12 Internal .QTP Screen (Keyword View) The Icon Based Tree in the Expert view provides modularity to the script. © SAP AG 2009. All rights reserved.

Object Repository… List Of Objects © SAP AG 2009. / Page 13 Internal . All rights reserved.

Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal .Agenda Introduction Modes of Recording Object Repository Actions. Parameterizations.

recognizing the objects in your application regardless of their location on the screen.Why Normal Recording ?  Normal recording mode records the objects in an application and the operations performed on them. This mode is the default and takes full advantage of the QuickTest test object model. / Page 15 Internal .  © SAP AG 2009. All rights reserved.

Normal Recording Record © SAP AG 2009. All rights reserved. / Page 16 Internal .

This mode is useful for the operation which you can record at Object Level. / Page 17 Internal .  © SAP AG 2009.Why Analog Recording ?  Actual movement of the mouse or keyboard is needed e. All rights reserved. paint etc. recording signature.g drawing a mouse signature. such as drawing a picture.

Analog Recording  In this recording mode. Quick Test records and tracks every movement of the mouse as it is dragged around a screen or window. / Page 18 Internal .  User cannot edit the analog recording steps from within Quick Test. All rights reserved. Example of Signature Capture © SAP AG 2009. The step is added after the recording stops.

Why Low level Recording ?    Recording on environments or objects not supported by QuickTest. All rights reserved. DblClick. Type  Window test objects: Click. Drag. Maximize © SAP AG 2009. Drag. DblClick. Restore. Minimize. Drop. Activate. The exact location of an object is necessary (x or y coordinates). Low-level recording supports the following methods for each test object:  WinObject test objects: Click. Type. / Page 19 Internal . Drop.

whether or not Quick Test recognizes the specific object or the specific operation. All rights reserved.  © SAP AG 2009. / Page 20 Internal .Low Level Recording  This enables us to record on any object in the application. This mode records at the object level and records all run-time objects as Window or Win Object test objects.

All rights reserved.Where is show… Demonstration © SAP AG 2009. / Page 21 Internal .

Break © SAP AG 2009. All rights reserved. / Page 22 Internal .

/ Page 23 Internal .  Analyze the code generated during the recording.  Please make sure to log off from Store Manager before exiting an action. © SAP AG 2009. All rights reserved.  Record the steps for the three modes separately in the three actions.Exercise for Automation Modes… Motive: Write a script to log on to the EPOS Manager Application using the three types of automation modes Applications Which can be used: ePOS : Link to be provided during the training Exercise: Create a Script with :  Create a script named as ―AutomationExercise‖  Make three actions which use the three ways of automation modes respectively to log on to the Store Manager.

Lunch © SAP AG 2009. All rights reserved. / Page 24 Internal .

Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal . Parameterizations.Agenda Introduction Modes of Recording Object Repository Actions.

What is an Object Repository   An Object Repository is a place where QTP stores learned Objects. © SAP AG 2009. All rights reserved. It displays a tree of all objects in the current component or in the current action or entire test( depending on the object repository mode we selected). / Page 26 Internal .

Quicktest  learns the default property values and determines in which test object class it fits. then it adds a special Ordinal identifier such as objects location on the page or in the source code.Understanding the Object Repository. © SAP AG 2009. one by one to the description until it has compiled the unique description. / Page 27 Internal .  If no assistive properties are available. If it is not enough it adds assistive properties. All rights reserved.

Object Repository Types Local Repository: Local repository stores objects in a file that is associated to specific action. so that only that action can access the stored objects. Action maintenance will be high. Shared Repository: (Recommended) Shared repository stores objects in a file that can be accessed by multiple test (in read-only mode). Local Repository are modifiable from specific action. © SAP AG 2009. / Page 28 Internal . All rights reserved. Shared repository are modifiable only via object repository manager. Action maintenance will low.

 You generally create single-action tests. © SAP AG 2009.Deciding Whether to Use Local or Shared Object Repositories In general. especially under the following conditions:  You have only one. or very few.  You have several tests that test elements of the same application. interface. or set of objects.  You often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to Action options. or set of objects. the local object repository is easiest to use when you are creating simple record and run tests. interface. Conversely.  You expect the object properties in your application to change from time to time and/or you regularly need to update or modify test object properties. tests that correspond to a given application.  You do not expect to frequently modify test object properties. the shared object repository is generally the preferred option when:  You are creating tests using keyword-driven methodologies (not using record). All rights reserved. / Page 29 Internal .

How to add objects to the Object Repository We can add objects to the Object Repository either during Recording or through the Object Repository Manager How to add objects while Recording? Record the steps that you want to perform. Navigate to the object repository and perform add objects operation and click particular object. / Page 30 Internal . All rights reserved. (local repository) Navigate to the object repository and perform add object operation and click on top most part of window which you are trying to automate (shared repository) © SAP AG 2009.

Object Repository Manager What is an Object Repository Manager? The Object Repository Manager enables you to manage all of the shared object repositories used in your organization from a single. / Page 31 Internal . All rights reserved. central location © SAP AG 2009.

Creation of a Shared Object Repository  Navigate  Click to object Repository manager on File ->New to create a new object Repository © SAP AG 2009. / Page 32 Internal . All rights reserved.

All rights reserved.Creation of a Shared Object Repository – Adding a single object at a time Click on the button to add objects to the repository Place the object spy on the User id field to display the object hierarchy Select the object to be added. Click on the OK button. © SAP AG 2009. / Page 33 Internal .

/ Page 34 Internal . All rights reserved.Creation of a Shared Object Repository – Adding multiple objects at a time Select the option -> default object types Click on the OK Button The hierarchy is displayed with the default objects present on the browser Highlight the objects to see that they are identified correctly © SAP AG 2009.

All rights reserved.Creation of a Shared Object Repository Login to the application and add the objects referring to the next screen We can find the links being added under the frame called menu © SAP AG 2009. / Page 35 Internal .

Similarly Save the Object Repository (folder present in a shared network drive) © SAP AG 2009.Saving the Repository Click on the link Employees and navigate to the screen where we can create a new employee add objects present in all the screens which we would use. All rights reserved. / Page 36 Internal .

Click on the Open button. All rights reserved. / Page 37 Internal . Click on the OK Button © SAP AG 2009.Associating the repository with the test Associate the repository with the Test by navigating to Resources-> Associate Repositories Click on the button and select the path where the repository is present.

All rights reserved. / Page 38 Internal .Associating the repository with the test Associate the Actions with the repository Save the test © SAP AG 2009.

All rights reserved. The options would appear and actions need to be performed as shown © SAP AG 2009.Scripting using the shared Object Repository Start the scripting by as shown below. / Page 39 Internal .

All rights reserved. / Page 40 Internal .Tool Exercise / Demo Motive: Using the given application create the following 2 types of repositories and associate them with your test   Local Repository Shared Repository  URL – The application to be used would be provided during the training session © SAP AG 2009.

Break © SAP AG 2009. / Page 41 Internal . All rights reserved.

Agenda Introduction Modes of Recording Object Repository Actions. Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal . Parameterizations.

When we run a test with multiple actions. basically a set of meaningful activity/clicks on UI (like Login. Logical Sequencing © SAP AG 2009.Actions : Actions are the logical units of test. each test begins with a single action. the tests will be more modular and efficient with less maintains effort. Dividing a test into actions helps us to streamline the testing process. Logoff…) A test comprises calls to actions. All rights reserved. Each action is stored together with the test. / Page 43 QTP Script Test Result Internal . the Test Results are divided by actions so that we can view the detailed results for each action individually. By default.

only once. All rights reserved. / Page 44 Internal . editable copy of external action. This can be of two types.Types of Actions : There are three kinds of actions: Non-re-usable: Action can be used in the local test. External: These are reusable actions created in another test. 1) Call to Existing Action : (Insert -> Call to Existing Action) External actions are read-only in the calling test 2) Call to Copy of Action : (Insert -> Call to Copy of Action) Local. multiple times. Re-usable: Action can be used in the local test. © SAP AG 2009.

3)Type 4)Add a new action name or accept the default name. . To insert the new action within the action of the currently selected step. 6)To insert a new action at the end of the test. All rights reserved. select After the current step. check the At the end of the test checkbox. 7)Click OK. a description of the action. / Page 45 Internal . 5)Select Reusable Action to make it reusable. The Insert 2)Choose Insert > Call to New Action or click the on Call to New Action button New Action dialog box opens. This can be modified at a later time in the Action properties dialog box. © SAP AG 2009.Create a New Action : Steps to create a New Action (or Reusable Action) : 1)Click the step after which you want to insert the new action.

/ Page 46 Internal . it needs to be updated only once. because when an object or procedure in the application changes.External Action : Call to Existing Action 1. calls to an action makes it easier to maintain tests. Call to Existing Action : (Insert -> Call to Existing Action) External Inserting actions are read-only in the calling test. in the original action © SAP AG 2009. All rights reserved.

All rights reserved. and the corresponding action tab in the Data Table. we can add to. including checkpoints. Any changes we make to this action after inserting it affect only this action. non-reusable action (even if the original action was reusable). Call to Copy of Action : (Insert -> Call to Copy of Action)  Local. parameterization. or modify the action. / Page 47 Internal . delete from. We can insert copies of both reusable and non-reusable actions © SAP AG 2009. When we insert a copy of an action into a test. and changes to the original action do not affect the inserted action. The action is inserted into the test as an independent. editable copy of external action. Once the action is copied into the test.External Action : Call to Copy of Action 2. the action is copied in its entirety.

/ Page 48 Internal .Steps .Call to Copy of Action Call to Copy of Action : Insert -> Call to Copy of Action Call to Copy of Action Call to Existing Action Difference © SAP AG 2009. All rights reserved.

Example :  Suppose we want to create the following three tests for ePOS application —    Add a new employee Edit an employee Delete an employee. These actions can later be called by Test 2 and Test 3. login and logOff to the ePOS application is common for all the three test so we need to create a total of five actions for all three tests. We would then finish creating Test 2 and Test 3 by inserting calls to the reusable actions which we created in Test 1. All rights reserved. Test 1 would contain two reusable actions (Login and LogOff). © SAP AG 2009. / Page 49 Internal .

a description. and optionally. / Page 50 Internal . So we can define FirstName & LastName as input parameters EmployeeNumber as Output parameter. and delete input and output parameters in the Parameters tab of the Action Properties dialog box (Edit > Action > Action Properties or right-click an action and choose Action Properties). 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. All rights reserved. we need to define a name (case sensitive). Out parameter can be consumed in other test (like – Search For Employee) © SAP AG 2009. For each input or output action parameter.Action Parameters : There are two Action Parameters : Input Parameter : Specifies the parameters that an action can receive values from the source that runs or Parameter : Specifies the parameters that an actions can pass to the source that runs or calls it calls it. modify. We can also specify a default value for each action input parameter. a type. Example : Creation of an Employee in ePOS application requires below details  First Name  Last Name And then application generates an Employee Number. Output We can define.

Exercise for Action :
Motive: Create a script to describe creation of new action & re-usable action and calling these reusable action to another script.

Applications Which can be used:
ePOS Application : To be given during training Exercise:
1.Create 2.Create 3.Create

a script named as ―GenericScript‖ with two reusable action ―Login‖ & ―LogOff‖ another script named as ―DemoScript‖ and call action ―Login‖ from ―GenericScript‖ an action ―Add a New Employee‖

3.1- Create input parameters as ―FirstName‖ & ―LastName‖ and an out put parameter ―EmployeeNumber‖
4.Create

an action ―Search For Employee‖

4.1 - Create an input parameter ―EmployeeNumber‖ and consume the Out put parameter from the previous action i.e. ―Add a New Employee‖.
5.

Call ―LogOff‖ Reusable action from ―GenericScript‖.

© SAP AG 2009. All rights reserved. / Page 51

Internal

End of Day 1

© SAP AG 2009. All rights reserved. / Page 52

Internal

Parameterization :

When

we test our applications, we may want to check how the application performs the same operations with multiple sets of data. For example,
Suppose We

we want to check how our Web site responds to ten separate sets of data.

could record ten separate tests, each with its own set of data.

Alternatively,

we can create Data Table parameters so that our test runs ten times, each time using a different set of data. this way of setting parameters is called …..

Parameterization

© SAP AG 2009. All rights reserved. / Page 53

Internal

Datatable several times using the data we supply. The test runs once for each line of data in the DataTable. We can specify the range from which the random number is generated. / Page 54 Internal . © SAP AG 2009. By default. Test/action parameters : Test parameters enable us to use values passed from test. or action that runs parameters enable us to pass values from other actions in the test. Each iteration takes a different value from the datatable.Parameterization : Parameterization can be done in four ways using Quick Test.  Random numbers : It enables us to use random numbers as values in the test. All rights reserved. Action : Data Table parameters enable us to create a data-driven test. Environment variable Parameters : The Environment variables can have Quick Test generated values or values supplied from external files. the random number range is between 0 and 100.

and then adds five new Employee. Example : Suppose we are creating a test for ePOS application . All rights reserved. We may want to create a test in which the user logs onto the application once. © SAP AG 2009. one to search created employee and a forth for LogOff. Global Data Sheet : We store data in the Global tab when we want it to be available to all actions in our test and we want the data to control the number of test iterations. / Page 55 Internal .Data Table : Global and Action Sheets The Data Table has two types of data sheets—Global and Action. one for Add a New Employee.―Add And Search New Employee‖.    This requires one action for Login. Action Data Sheet : We store data in the action's tab when we want to use the data in Data Table parameters for that action only and we want the data to control the number of action iterations. so it should be stored in the action tab corresponding to that action. Global sheet enables us to pass information between actions. The data about the employee is relevant only to the second action.

Choose User-defined from the variable type. / Page 56 . External The Structure of the xml File should as per the screenshot below To upload an external XML file : Check Box – ―Load variables and values from external file‖ and Provide the XML path. All rights reserved.Environment variable Parameters : The We Environment variables can have Quick Test generated values or values supplied from external files. Internal Select © SAP AG 2009. can add environment variables from Test->Settings->Environment tab. Click Click to create our own internal variables to Export user-defined environment variables to an XML file XML File : QTP supports uploading an external xml file with parameters.

100) -. SheetID]) = Y   -.Action OutPut parameter will hold the value of Y Data Table : Data Table values can be set/retrieved via below command   X = DataTable.Environment variable will hold the value of Y Random numbers : Generates a value for the specified RandomNumber parameter To generate any random number:   RandomNumber.Value(0.QTP will generate a random number between 0 to 100 Internal © SAP AG 2009. SheetID]) DataTable.X will hold the test Input Parameter value -.Test OutPut parameter will hold the value of Y Action parameters : Action Parameter can be set/retrieved via below command   X = Parameter(―InputParameter‖) Parameter(―OutParameter‖) = Y -.X will hold the action Input Parameter value -.ParameterID will hold the value of Y ParameterID = Column name in data table SheetID = Global or Action sheet name Environment Variable : Environment variable can be set/retrieved via below command  X = Environment. / Page 57 .EndNumber) Example : X = RandomNumber.value("VariableName") = Y -.Value(StartNumber.Value(ParameterID [.QTP : Methods Test parameters : Test Parameter can be set/retrieved via below command   X = TestArgs(―InputParameter‖) TestArgs(―OutParameter‖) = Y -.X will hold the environment variable value  Environment.value("VariableName") -.X will hold the data table ParameterID‘s value -.Value(ParameterID [. All rights reserved.

All rights reserved. / Page 58 Internal . Create a Script to ―Add a New Employee‖ 2. Provide the data for First Name & Last Name via    Test/action parameters Data Table Environment variable Parameters  Random numbers © SAP AG 2009.Exercise for Parameterization : Motive: Create a script to describe different ways of Parameterization. Applications Which can be used: ePOS Application : Link will be provided during training Exercise: 1.

and contains all the other sub-directories in the path. Relative Path = ―FunctionLib.vbs‖ Relative path : [A]. regardless of the current directory.vbs‖ located in ―C:\Documents and Settings\I043155\Desktop\Lib‖.Absolute and Relative Paths : QuickTest enables us to define the path to a resource that we are adding to the file system. and is generally only a portion of the absolute path.vbs‖ if Reference/Folder Path = ―C:\Documents and Settings\I043155\Desktop\Lib‖ [B]. as a relative or an absolute path Absolute Path : An absolute path describes the full path to a specific file starting from a fixed location such as the root directory.vbs‖ if Reference/Folder Path = ―C:\Documents and Settings\I043155\Desktop‖ Absolute Path = [Reference/Folder Path ] + [ Relative Path ] © SAP AG 2009. Relative Path = ―Lib\FunctionLib. Example : Consider a QuickTest resource file named ―FunctionLib. or the drive on which the file is located. A relative path therefore specifies the location of the file relative to the given location in the file system. / Page 59 Internal . Absolute & Relative path to the file are as below : Absolute path : ―C:\Documents and Settings\I043155\Desktop\Lib\FunctionLib. Relative Path : A relative path describes the path to a specific file starting from a given directory. An absolute path always points to the specified file. All rights reserved.

702 and 701 functionality remains same in 702 as well then we can port 701 script to 702. For this reason.Advantage of Relative Path : Using relative paths means that the paths remain valid when files or folders containing files are moved or copied to other locations or computers. provided that they are moved within the same folder structure.e. Maintain     relative paths for below QTP resources : Library Reusable Actions Repository Environment Parameters Example : Suppose we have scripts for 701 code line and there is new code line released i. Tools -> Options -> Folders © SAP AG 2009. All rights reserved. as best practice we should use relative paths when saving resources in QuickTest. / Page 60 Internal .

Control Statements and Important Methods… Control  Statements: Do…Loop Statement     For….Next Statement If…Then…Else Statement Select Case Statement While…Wend Statement Important     Methods: GetROProperty WaitProperty GetCellText ChildObjects © SAP AG 2009. / Page 61 Internal . All rights reserved.

If condition is Null. condition is treated as False statements: One or more statements that are repeated while or until condition is True © SAP AG 2009. • Syntax: Do [{While | Until} condition] [statements] [Exit Do] [statements] Loop • Arguments: condition: Numeric or string expression that is True or False. / Page 62 Internal . All rights reserved.Control Statements… •Do…Loop • Statement: Repeats a block of statements while a condition is True or until a condition becomes True.

end: Final value of counter. step defaults to one. / Page 63 Internal . • Syntax: For counter = start To end [Step step] [statements] [Exit For] [statements] Next • Arguments: counter : Numeric variable used as a loop counter. © SAP AG 2009. The variable can't be an array element or an element of a user-defined type. statements: One or more statements between For and Next that are executed the specified number of times.Control Statements… •For…Next • Statement: Repeats a group of statements a specified number of times. step: Amount counter is changed each time through the loop. If not specified. All rights reserved. start: Initial value of counter.

executed if condition is True. condition-n: Same as condition. statements: One or more statements separated by colons. .Control Statements… •If…Then…Else • Statement: Conditionally executes a group of statements. © SAP AG 2009. • Syntax: If condition Then [statements] [ElseIf condition-n Then [elseifstatements]] . condition is treated as False. elseifstatements: One or more statements executed if the associated condition-n is True. depending on the value of an expression. All rights reserved. / Page 64 Internal . elsestatements: One or more statements executed if no previous condition or condition-n expression is True. [Else End If • [ elsestatements]] Arguments: condition: One or more of the following two types of expressions: A numeric or string expression that evaluates to True or False. . If condition is Null.

All rights reserved. . elsestatements-n: One or more statements executed if testexpression doesn't match any of the Case clauses © SAP AG 2009. Syntax: Select Case testexpression [Case expressionlist-n [statements-n]] . / Page 65 Internal . [Case Else expressionlist-n [elsestatements-n]] End Select Arguments: testexpression: Any numeric or string expression expressionlist-n: Required if Case appears.Control Statements… •Select • Case Statement: Executes one of several groups of statements. statements-n: One or more statements executed if testexpression matches any part of expressionlist-n. . depending on the value of an expression. Delimited list of one or more expressions.

/ Page 66 Internal . statements: One or more statements executed while condition is True © SAP AG 2009. If condition is Null.Control Statements… •While…Wend • Statement: Executes a series of statements as long as a given condition is True. condition is treated as False. All rights reserved. • Syntax: While condition Version [statements] Wend Arguments: condition: Numeric or string expression that evaluates to True or False.

WaitProperty (PropertyName. [PropertyData]) Arguments: object: A test object Property: Required. [TimeOut]) © SAP AG 2009. Syntax: object. A String value. The property to retrieve from the object.Important Methods… •GetROProperty: • Returns the current value of the test object property from the object in the application Syntax: object. PropertyValue. Not in use. / Page 67 Internal . •WaitProperty: • Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. All rights reserved. PropertyData: Optional.GetROProperty (Property. A Variant value.

A String value. QuickTest uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box. •GetCellData: • Retrieves the contents of the specified cell from the table. All rights reserved. TimeOut: Optional.Important Methods… Arguments: object: A test object PropertyName: Required. Syntax: object. after which QuickTest continues to the next step if the specified value is not achieved. / Page 68 Internal . A Variant value. The time. The name of the property whose value is checked. A Long value. Column) © SAP AG 2009. The value to be achieved before continuing to the next step. If no value is specified. in milliseconds. PropertyValue: Required. Specify the value as a string.GetCellData (Row.

A Properties (collection) object. A Variant. refer to the Utility section of the QuickTest Professional Object Model Reference. •ChildObjects: • Returns the collection of child objects contained within the object. © SAP AG 2009. An Object object. The name or 0-based index of the column containing the cell whose data you want to retrieve. / Page 69 Internal . The 0-based index of the row containing the cell whose data you want to retrieve. A Variant value. For more information on the Description object. All rights reserved. Tip: You can retrieve a Properties collection using the GetTOProperties method or you can build a Properties collection object using the Description object. Syntax: object.Important Methods… Arguments: object: A test object Row: Required. Column: Required.ChildObjects ([Description]) Arguments: Description: Optional.

Break © SAP AG 2009. All rights reserved. / Page 70 Internal .

Agenda Introduction Modes of Recording Object Repository Actions. Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal . Parameterizations.

methods. we can define our own function libraries containing VBScript functions.Introduction In addition to the test objects. and then call their functions from our test. All rights reserved. / Page 72 Internal . and so forth. and built-in functions supported by the QuickTest Test Object Model. © SAP AG 2009. modules. subroutines.

/ Page 73 Internal . All rights reserved. easier to maintain read and design. © SAP AG 2009. They can be called from within an action.At a Glance…  User-defined Functions make our tests look shorter.

/ Page 74 Internal . © SAP AG 2009. Click on the ―+‖ icon to add the library file (*.How to Add Resource to a Test   Go to File -> Settings -> Resources. All rights reserved.qfl) to the test.

All rights reserved. / Page 75 Internal . The method referred into an action from a Library…… © SAP AG 2009.An Example….

Easy to create and define a Function Library. / Page 76 Internal .    © SAP AG 2009.Advantages  Time and Resources are saved by implementing and using user-defined reusable functions. as these files are accessed directly and are not saved as local copies when the test is opened. All the users can choose functions that perform complex operations without adding the code directly to the test. Any changes are implemented immediately. All rights reserved.

© SAP AG 2009. All rights reserved.Key Notes   The file extension of a library file is *.  Steps using user-defined functions are not displayed in the test results tree of the Test Results window by default.Event. or Can be entered manually in the Expert View. / Page 77 Internal . Functions in an associated function library are accessible    From Step Generator From the Operation column in the Keyword View.qfl. use Reporter.

/ Page 78 Internal .Where is show… Demonstration © SAP AG 2009. All rights reserved.

All rights reserved. / Page 79 Internal . Applications Which can be used: ePOS : Link to be provided during the training Exercise: Create a Script with :     Create a script named as ―FunctionLibExercise‖ Create a function library which contains the method to click on a Link on the main page of a Web Page Associate the library to the test ―FunctionLibExercise‖ Call the method into the script and Execute © SAP AG 2009.Exercise for Function Library… Motive: Make a function library which contains the method to click on a link on a web page.

All rights reserved. / Page 80 Internal .Lunch Break © SAP AG 2009.

Parameterizations.Agenda Introduction Modes of Recording Object Repository Actions. Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal .

Verify text in status bar .Verify value in a grid . / Page 82 Internal .Verify bitmaps The status of a checkpoint (passed or failed) is located in the Test Results Summary © SAP AG 2009. that compares the actual value of a specified object property to an expected value of the same property Example: . All rights reserved.What is a Checkpoint A checkpoint is a step in the test.

checks that a single line text string is displayed in the appropriate place in the application Text Area Checkpoint .checks the contents of a database accessed by the application XML Checkpoint . All rights reserved.checks an area of an application as a bitmap Database Checkpoint .checks the data content of XML documents in XML files or XML documents in Web pages and frames © SAP AG 2009.Types of Checkpoints Text Checkpoint . / Page 83 Internal .checks that a multi line text string is displayed in the appropriate place in the application Bitmap Checkpoint .

checks the property value of an object in the application Accessibility Checkpoint .identifies areas of a Web site that may not conform to the World Wide Web Consortium © SAP AG 2009.Types of Checkpoints Standard Checkpoint . All rights reserved. / Page 84 Internal .

/ Page 85 Internal .Text Checkpoint When do we use a Text Checkpoint?  A text checkpoint is used when we need to check that a single line text string is displayed in the appropriate place in the application How do we add a Text Checkpoint? Navigate to the screen where you would like to capture the object to be checked Navigate to Insert->Checkpoint->Text Checkpoint Select the option ‗Checked Text‘ which can be a constant or parameterized from the data table. © SAP AG 2009. All rights reserved. ‗Checked before‘ and ‗Checked After‘ option can also be used.

a result window will pop up showing the success or failure of the run.Text Checkpoint After running the script. / Page 86 Internal . When you expand the nodes. you can see the result of the checkpoint. All rights reserved. Result – The text ‗Manage Tills ‗ appears between ‗Management‘ and ‗Create‘ © SAP AG 2009.

/ Page 87 Internal . Quick Test window is minimized. Click on the OK button © SAP AG 2009.Standard Checkpoint When do we use a standard checkpoint? A standard checkpoint is used when we need to checks the property value of an object in the application How do we add a standard checkpoint? Select The  Insert -> Checkpoint -> Standard Checkpoint Value button. All rights reserved. and the pointer turns into a pointing hand Select the object you need to check and select the properties with which you would like to check the result.

When you expand the nodes. All rights reserved. you can see the result of the checkpoint. value= ‗FONT‘ & innertext . / Page 88 Internal .Standard Checkpoint After running the script. a result window will pop up showing the success or failure of the run. Result – The ‗Manager Functions‘ Web Element exists with the below properties: Html tag . value = ‗Manager Functions‘ © SAP AG 2009.

Standard Checkpoint for Tables When do we use a standard checkpoint for Tables? A standard checkpoint is used when we need to check any value within a table How do we add a standard checkpoint for tables? Navigate to Insert->Checkpoint->Standard Checkpoint Select the table area->Select the Webtable from the hierarchy as shown below. All rights reserved. / Page 89 Internal . Click on OK button © SAP AG 2009.

Standard Checkpoint for Tables How do we add a standard checkpoint for tables? Select the cell content which needs to be checked. All rights reserved. / Page 90 Internal . the value if required as shown below (user id field). Click on OK button Parameterize © SAP AG 2009.

you can see the result of the checkpoint. When you expand the nodes. a result window will pop up showing the success or failure of the run. All rights reserved.Standard Checkpoint for Tables After running the script. Result – The value in the User ID field is correctly displayed in the table © SAP AG 2009. / Page 91 Internal .

/ Page 92 Internal . Select the area which needs to be checked and click on ‗OK‘ button. All rights reserved.Bitmap Checkpoint When do we use a Bitmap checkpoint? A Bitmap How checkpoint is used when we need to check an area of an application as a bitmap do we add a Bitmap checkpoint? Consider the bitmap image as shown below which needs to be checked Navigate to Insert->Checkpoint->Bitmap checkpoint. © SAP AG 2009. Select the bitmap and click on Select area button.

Result – The bitmap exists in the application © SAP AG 2009. All rights reserved. a result window will pop up showing the success or failure of the run. you can see the result of the checkpoint. / Page 93 Internal .Bitmap Checkpoint After running the script. When you expand the nodes.

Choose Insert -> Checkpoint -> Database. The Database Query Wizard opens. Define a query on your database and then create a database checkpoint that checks the results of the query. You can define a database query in the following ways Using Microsoft Query.Database Checkpoint When do we use a Database checkpoint? A database How checkpoint is used when we need to check the contents of a database accessed by the application do we add a Database checkpoint? . © SAP AG 2009. All rights reserved. You can install Microsoft Query from the custom installation of Microsoft Office. / Page 94 Internal . By manually defining an SQL statement.

The screen that opens depends on the option you selected in the previous step If you chose Create query using Microsoft Query in the previous step. Specify SQL statement manually. / Page 95 Internal .Database Checkpoint How do we add a Database checkpoint? . Select your database selection preferences. Specify the connection string and the SQL statement. enables you to specify the connection string and an SQL statement. the Specify SQL statement screen opens. This option is available only if you have Microsoft Query installed on your computer. Microsoft Query is opened. Define a query on your database and then create a database checkpoint that checks the results of the query. Click Next. You can choose from the following options: Create query using Microsoft Query. All rights reserved. Maximum number of rows checkbox should be selected if you would like to limit the number of rows and enter the maximum number of database rows to check or output. and click Finish . Choose a data source and define a query If you chose Specify SQL statement manually in the previous step. Microsoft Query opens. The Specify SQL statement screen in the wizard. You can specify a maximum of 32. enabling you to create a new query.000 rows. © SAP AG 2009.

All rights reserved. Enter the connection string. / Page 96 Internal .dsn file in the ODBC Select Data Source dialog box or create a new .Database Checkpoint Specifying SQL Statements Choose Specify SQL statement in the Database Query Wizard. and click Finish. The following screen opens Specify the connection string and the SQL statement. You can select a . or click Create to open the ODBC Select Data Source dialog box.dsn file to have the Database Query Wizard insert the connection string in the box Enter the SQL statement © SAP AG 2009.

/ Page 97 Internal . Click OK to close the dialog box. A checkpoint or output value statement is added for the selected object in the Keyword View and Expert View. All rights reserved.Database Checkpoint Database Checkpoint Properties Dialog Box Select The the checks or outputs to perform on the result set Database Checkpoint Properties dialog box enables you to specify which cell contents of your database to check and which verification method and type to use. You can also edit or parameterize the expected data for the cells included in the check. © SAP AG 2009.

Checkpoint Properties dialog box opens Select Create new checkpoint from file. All rights reserved. Navigate to Insert->Checkpoint->XML Checkpoint(Resource) The XML Source Selection . The XML Checkpoint Properties dialog box opens. / Page 98 Internal . © SAP AG 2009.XML Checkpoint When do we use an XML checkpoint? An XML checkpoint is used when we need to check the data content of XML documents in XML files or XML documents in Web pages and frames How do we add an XML checkpoint? . Click OK in the XML Source Selection. Enter the file path or Internet address of the XML file.

All rights reserved. / Page 99 Internal .XML Checkpoint The XML Checkpoint Properties dialog box displays the element hierarchy and values of the selected child. Click on the OK button The XML Checkpoint gets generated as shown in the next slide © SAP AG 2009.

you can see the result of the checkpoint. Result – The value ‗123‘ (expected value) exists in the xml.XML Checkpoint After running the script. When you expand the nodes. / Page 100 Internal . All rights reserved. © SAP AG 2009. a result window will pop up showing the success or failure of the run.

All rights reserved. / Page 101 Internal .XML Checkpoint In case the checkpoint fails the result appears as below Here the expected value and actual value differ © SAP AG 2009.

All rights reserved.Tool Demo / Exercise Motive: Use the given application create a new employee and add the following checkpoints: Standard Standard Bitmap Text Checkpoint Table Checkpoint Checkpoint Checkpoint Checkpoint Database XML Checkpoint URL : The application URL would be provided during the training © SAP AG 2009. / Page 102 Internal .

All rights reserved.Break © SAP AG 2009. / Page 103 Internal .

Agenda Introduction Modes of Recording Object Repository Actions. Parameterizations. Paths & Conditions Function Library CheckPoints Descriptive Programming Glossary Internal .

 This © SAP AG 2009. is a programming technique which describes an object through specific properties of the object into consideration. All rights reserved. / Page 105 Internal . technique of scripting does not use QTP‘s Object Repository (OR) in which we specify properties and values of the object.What is Descriptive Programming?  An  It approach through which the objects under test are recognized dynamically.

The best example would be of clicking a link which changes according to the user of the application. to a test case is needed but the Object repository for the same is Read only or in shared mode i. of objects being added leading to decreased performance of Object Identification.Why and When to use Descriptive Programming  The objects in the application are dynamic in nature and need special handling to identify the object.e. changes may affect other scripts as well. All rights reserved. object repository is getting huge due to the no. Ex. we are not able record certain specific object e. ―Logout <<UserName>>‖.  When  Modification  When  When © SAP AG 2009. Sub Menus etc. hidden panels. Nested inner-object. Objects with changing hierarchies.g. / Page 106 Internal . we have to work with different methods and the different actions have different ORs.

© SAP AG 2009. giving the description in form of the string arguments. / Page 107 Internal . All rights reserved.How to use Descriptive Programming There are two ways in which descriptive programming can be used: By By creating properties collection object for the description.

ChildObjects(Desc). / Page 108 Internal . © SAP AG 2009.Properties collection object for the description. To use this method we first create an empty description: The description of the Object is created as follows: We use the Object in the following manner: When we say . All rights reserved. it finds the collection of all the Images on the page having the properties defined previously.

/ Page 109 Internal .  PropertyName:=PropertyValue—the test object property and its value. Each property:=value pair should be separated by commas and quotation marks. All rights reserved.Giving the description in form of the string arguments.  Object properties specified in a statement by specifying property:=value pairs TestObject—the test object class could be WebEdit. © SAP AG 2009. WebRadioGroup etc….

Value = “user_name” Set Lists = Browser("name:=SAP Enterprise POS.Page("title:=SAP Enterprise POS.*”).Create() Obj_oDesc("micclass").Set “posManager” © SAP AG 2009.Code Example  By creating properties collection object for the description. The following code assigns the value to the first object out of the object collection of WebEdit class defined by the properties: Set Obj_oDesc = Description.*”). / Page 110 Internal .ChildObjects(Obj_oDesc) Lists(0). All rights reserved.Value = “WebEdit” Obj_oDesc(“name”).

/ Page 111 Internal .*”).*”).WebEdit(“name:=user_name”).Page("title:=SAP Enterprise POS.Code Example Continued…  By giving the description in form of the string arguments.Set “posManager” © SAP AG 2009. The following line of code sets the value of the username edit box: Browser("name:=SAP Enterprise POS. All rights reserved.

/ Page 112 Internal . All rights reserved.Where is show… Demonstration © SAP AG 2009.

Please make sure to log off from Store Manager before running the second action. © SAP AG 2009.Exercise for Descriptive Programming… Motive: Write a script to log on to the EPOS Manager Application using the two methods of descriptive programming Applications Which can be used: ePOS : Link to be provided during the training Exercise: Create a Script with :    Create a script named as ―DPExercise‖ Make two actions which use the two ways of Descriptive Programming to log on to the Store Manager. All rights reserved. / Page 113 Internal .

Parameterizations.Agenda Introduction Modes of Recording Object Repository Actions. Paths & Conditions Function Library CheckPoints Internal Descriptive Programming Glossary .

/ Page 115 Internal . waits for the user to click a button. The QuickTest Print Log window remains open while the run session continues. All rights reserved. © SAP AG 2009. until we close it.Glossary : Msgbox & Print  Msgbox : Displays a message in a dialog box.  Print : Displays information in the QuickTest Print Log window during the run session.

/ Page 116 Internal .ReporterEvent : Reports an event to the test results © SAP AG 2009.ReporterEvent Reporter. All rights reserved.Glossary : Reporter.

Glossary : System time & Date & Locale Check System time & date Locale check – GetLocale & SetLocale © SAP AG 2009. / Page 117 Internal . All rights reserved.

All rights reserved. / Page 118 Internal .Thank you! © SAP AG 2009.

Sign up to vote on this title
UsefulNot useful