Documente Academic
Documente Profesional
Documente Cultură
Internal
On Premise Suite Test Center
TIP CORE ECF India
Agenda
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
Agenda for the Day 1
Agenda Time
Expectation Setting 8:30 A.M – 9:00 A.M
Agenda Time
Function Library 8:30 A.M – 10:30 A.M
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
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….
Windows
C++, Visual Basic, Java, .NET, Power Builder
Web
Web Applications, Web services, Flash
Browsers
Netscape, IE, AOL, Firefox
Other technologies
SAP, Siebel, Oracle, Peoplesoft, ActiveX
Enables collaboration among workgroups with shared function libraries and robust
object management
Point-and-check interface for accessing & interacting with the components of the
application under test
Has an Icon-Based test tree in which each branch represents a step in the
business process
Test toolbar
contains buttons to assist you in the testing process (e.g. record, run..)
Debug toolbar
contains buttons to assist you in debugging your test
Action toolbar
contains buttons and a list of actions, 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. All rights reserved. / Page 10 Internal
QTP Screen (Expert View)…
Toolbars
Active Screen
Information Pane
List Of Objects
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
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, recognizing the objects in your application regardless of their location on
the screen.
Record
This mode is useful for the operation which you can record at Object Level, such
as drawing a picture, recording signature.
In this recording mode, Quick Test records and tracks every movement of the
mouse as it is dragged around a screen or window.
User cannot edit the analog recording steps from within Quick Test. The step is
added after the recording stops.
Demonstration
Motive: Write a script to log on to the EPOS Manager Application using the three
types of automation modes
Exercise:
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
What is an Object Repository
Quicktest learns the default property values and determines in which test object class it fits.
If it is not enough it adds assistive properties, one by one to the description until it has
compiled the unique description.
If no assistive properties are available, then it adds a special Ordinal identifier such as objects
location on the page or in the source code.
In general, the local object repository is easiest to use when you are creating simple record and
run tests, especially under the following conditions:
You have only one, or very few, tests that correspond to a given application, interface, or
set of objects.
You do not expect to frequently modify test object properties.
You generally create single-action tests.
Conversely, the shared object repository is generally the preferred option when:
You are creating tests using keyword-driven methodologies (not using record).
You have several tests that test elements of the same application, interface, or set of
objects.
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.
You often work with multi-action tests and regularly use the Insert Copy of Action and Insert
Call to Action options.
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.
(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)
The Object Repository Manager enables you to manage all of the shared object repositories
used in your organization from a single, central location
Place the object spy on the User id field to display the object hierarchy
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
Click on the link Employees and navigate to the screen where we can create a new employee
Similarly add objects present in all the screens which we would use.
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
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
Actions :
Actions are the logical units of test, basically a set of meaningful activity/clicks on UI
(like Login, Logoff…)
A test comprises calls to actions. By default, each test begins with a single action.
Dividinga test into actions helps us to streamline the testing process, the tests will
be more modular and efficient with less maintains effort.
When we run a test with multiple actions, the Test Results are divided by actions so
that we can view the detailed results for each action individually.
Logical Sequencing
© SAP AG 2009. All rights reserved. / Page 43 QTP Script Test Result Internal
Types of Actions :
External: These are reusable actions created in another test. This can be of two types.
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, editable copy of
external action.
1)Click the step after which you want to insert the new action.
2)Choose Insert > Call to New Action or click the on Call to New Action button . The Insert
New Action dialog box opens.
5)Select Reusable Action to make it reusable. This can be modified at a later time in the Action
properties dialog box.
6)To insert a new action at the end of the test, check the At the end of the test checkbox. To
insert the new action within the action of the currently selected step, select After the current
step.
7)Click OK.
Inserting calls to an action makes it easier to maintain tests, because when an object
or procedure in the application changes, it needs to be updated only once, in the
original action
When we insert a copy of an action into a test, the action is copied in its entirety,
including checkpoints, parameterization, and the corresponding action tab in the Data
Table.
The action is inserted into the test as an independent, non-reusable action (even if the
original action was reusable).
Once the action is copied into the test, we can add to, delete from, or modify the
action.
Any changes we make to this action after inserting it affect only this action, and
changes to the original action do not affect the inserted action.
Difference
Suppose we want to create the following three tests for ePOS application —
Add a new employee
Edit an employee
Delete an employee.
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.
Test 1 would contain two reusable actions (Login and LogOff). These actions can later be
called by Test 2 and Test 3.
We would then finish creating Test 2 and Test 3 by inserting calls to the reusable actions which
we created in Test 1.
Input Parameter : Specifies the parameters that an action can receive values from the source that runs or
calls it.
Output Parameter : Specifies the parameters that an actions can pass to the source that runs or calls it
We can define, modify, 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).
For each input or output action parameter, we need to define a name (case sensitive), a type, and optionally,
a description.
We can also specify a default value for each action input parameter. the default value is saved with the
action and is used by the action if a value is not defined for a parameter in the action call.
Motive: Create a script to describe creation of new action & re-usable action and calling these
reusable action to another script.
Exercise:
1.Create a script named as ―GenericScript‖ with two reusable action ―Login‖ & ―LogOff‖
2.Create another script named as ―DemoScript‖ and call action ―Login‖ from ―GenericScript‖
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 want to check how our Web site responds to ten separate sets of data.
We 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
Test/action parameters : Test parameters enable us to use values passed from test. Action
parameters enable us to pass values from other actions in the test.
Datatable : Data Table parameters enable us to create a data-driven test, or action that runs
several times using the data we supply. The test runs once for each line of data in the DataTable.
Each iteration takes a different value from the datatable.
Environment variable Parameters : The Environment variables can have Quick Test
generated values or values supplied from external files.
Random numbers : It enables us to use random numbers as values in the test. We can
specify the range from which the random number is generated. By default, the random number
range is between 0 and 100.
The Data Table has two types of data sheets—Global and Action.
GlobalData 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. Global sheet enables us to pass information
between actions.
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.
Example : Suppose we are creating a test for ePOS application - ―Add And Search New Employee‖.
This requires one action for Login, one for Add a New Employee, one to search created employee and a forth for LogOff.
We may want to create a test in which the user logs onto the application once, and then adds five new Employee.
The data about the employee is relevant only to the second action, so it should be stored in the action tab corresponding to
that action.
The Environment variables can have Quick Test generated values or values supplied from external files.
We can add environment variables from Test->Settings->Environment tab. Choose User-defined from the
variable type.
External XML File : QTP supports uploading an external xml file with parameters.
The Structure of the xml File should as per the screenshot below
Select Check Box – ―Load variables and values from external file‖ and Provide the XML path.
© SAP AG 2009. All rights reserved. / Page 56 Internal
QTP : Methods
Data Table : Data Table values can be set/retrieved via below command
X = DataTable.Value(ParameterID [, SheetID]) -- X will hold the data table ParameterID‘s value
DataTable.Value(ParameterID [, SheetID]) = Y -- ParameterID will hold the value of Y
ParameterID = Column name in data table
SheetID = Global or Action sheet name
Exercise:
QuickTest enables us to define the path to a resource that we are adding to the file system, 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, or the drive on which the file is located, and contains all the other sub-directories in the
path. An absolute path always points to the specified file, regardless of the current directory.
Relative Path : A relative path describes the path to a specific file starting from a given directory, and is
generally only a portion of the absolute path. A relative path therefore specifies the location of the file relative
to the given location in the file system.
Example : Consider a QuickTest resource file named ―FunctionLib.vbs‖ located in ―C:\Documents and
Settings\I043155\Desktop\Lib‖. Absolute & Relative path to the file are as below :
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. For this reason, as best practice we should use relative paths when saving
resources in QuickTest.
Example : Suppose we have scripts for 701 code line and there is new code line released i.e. 702 and 701
functionality remains same in 702 as well then we can port 701 script to 702.
Control Statements:
Do…Loop Statement
For….Next Statement
If…Then…Else Statement
Select Case Statement
While…Wend Statement
Important Methods:
GetROProperty
WaitProperty
GetCellText
ChildObjects
•Do…Loop Statement:
• Repeats a block of statements while a condition is True or until a condition becomes True.
• Syntax:
Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]
Loop
• Arguments:
condition: Numeric or string expression that is True or False. If condition is Null,
condition is treated as False
statements: One or more statements that are repeated while or until condition is True
•For…Next Statement:
• Repeats a group of statements a specified number of times.
• Syntax:
For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next
• Arguments:
counter : Numeric variable used as a loop counter. The variable can't be an array element
or an element of a user-defined type.
start: Initial value of counter.
end: Final value of counter.
step: Amount counter is changed each time through the loop. If not specified, step defaults
to one.
statements: One or more statements between For and Next that are executed the
specified number of times.
•If…Then…Else Statement:
• Conditionally executes a group of statements, depending on the value of an expression.
• Syntax:
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements]] . . .
[Else [
elsestatements]]
End If
• 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, condition is treated as False.
statements: One or more statements separated by colons; executed if condition is True.
condition-n: Same as condition.
elseifstatements: One or more statements executed if the associated condition-n is True.
elsestatements: One or more statements executed if no previous condition or condition-n
expression is True.
•While…Wend Statement:
• Executes a series of statements as long as a given condition is True.
• Syntax:
While condition
Version [statements]
Wend
Arguments:
condition: Numeric or string expression that evaluates to True or False. If condition is Null,
condition is treated as False.
statements: One or more statements executed while condition is True
•GetROProperty:
• Returns the current value of the test object property from the object in the application
Syntax:
object.GetROProperty (Property, [PropertyData])
Arguments:
object: A test object
Property: Required. A String value. The property to retrieve from the object.
PropertyData: Optional. A Variant value. Not in use.
•WaitProperty:
• Waits until the specified object property achieves the specified value or exceeds the
specified timeout before continuing to the next step.
Syntax:
object.WaitProperty (PropertyName, PropertyValue, [TimeOut])
Arguments:
object: A test object
PropertyName: Required. A String value. The name of the property whose value is
checked.
PropertyValue: Required. A Variant value. The value to be achieved before continuing to
the next step. Specify the value as a string.
TimeOut: Optional. A Long value. The time, in milliseconds, after which QuickTest
continues to the next step if the specified value is not achieved. If no value is specified,
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.
Syntax:
object.GetCellData (Row, Column)
Arguments:
object: A test object
Row: Required. A Variant value. The 0-based index of the row containing the cell whose
data you want to retrieve.
Column: Required. A Variant. The name or 0-based index of the column containing the
cell whose data you want to retrieve.
•ChildObjects:
• Returns the collection of child objects contained within the object.
Syntax:
object.ChildObjects ([Description])
Arguments:
Description: Optional. An Object object. A Properties (collection) object.
Tip: You can retrieve a Properties collection using the GetTOProperties method or you can
build a Properties collection object using the Description object. For more information on the
Description object, refer to the Utility section of the QuickTest Professional Object Model
Reference.
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
Introduction
In addition to the test objects, methods, and built-in functions supported by the
QuickTest Test Object Model, we can define our own function libraries containing
VBScript functions, subroutines, modules, and so forth, and then call their functions
from our test.
User-defined Functions make our tests look shorter, easier to maintain read and
design. They can be called from within an action.
Click on the ―+‖ icon to add the library file (*.qfl) to the test.
All the users can choose functions that perform complex operations without
adding the code directly to the test.
Any changes are implemented immediately, as these files are accessed directly
and are not saved as local copies when the test is opened.
Steps using user-defined functions are not displayed in the test results tree of the
Test Results window by default; use Reporter.Event.
Demonstration
Motive: Make a function library which contains the method to click on a link on a
web page.
Exercise:
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
What is a Checkpoint
A checkpoint is a step in the test, that compares the actual value of a specified object property to
an expected value of the same property
Example:
- Verify bitmaps
The status of a checkpoint (passed or failed) is located in the Test Results Summary
Text Checkpoint - checks that a single line text string is displayed in the
appropriate place in the application
Text Area Checkpoint - checks that a multi line text string is displayed
in the appropriate place in the application
After running the script, a result window will pop up showing the success or failure of the run.
When you expand the nodes, you can see the result of the checkpoint.
Result – The text ‗Manage Tills ‗ appears between ‗Management‘ and ‗Create‘
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 Insert -> Checkpoint -> Standard Checkpoint Value button.
The Quick Test window is minimized, 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. Click on the OK button
After running the script, a result window will pop up showing the success or failure of the run.
When you expand the nodes, you can see the result of the checkpoint.
Result – The ‗Manager Functions‘ Web Element exists with the below properties:
Html tag ; value= ‗FONT‘ & innertext ; value = ‗Manager Functions‘
After running the script, a result window will pop up showing the success or failure of the run.
When you expand the nodes, you can see the result of the checkpoint.
Result – The value in the User ID field is correctly displayed in the table
After running the script, a result window will pop up showing the success or failure of the run.
When you expand the nodes, you can see the result of the checkpoint.
Result – The bitmap exists in the application
Specify the connection string and the SQL statement, and click Finish.
Enter the connection string, or click Create to open the ODBC Select Data Source dialog
box. You can select a .dsn file in the ODBC Select Data Source dialog box or create a
new .dsn file to have the Database Query Wizard insert the connection string in the
box
Enter the SQL statement
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.
© SAP AG 2009. All rights reserved. / Page 97 Internal
XML Checkpoint
Select Create new checkpoint from file. Enter the file path or Internet address of the XML
file.
Click OK in the XML Source Selection. The XML Checkpoint Properties dialog box opens.
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
After running the script, a result window will pop up showing the success or failure of the run.
When you expand the nodes, you can see the result of the checkpoint.
Result – The value ‗123‘ (expected value) exists in the xml.
Motive:
Use the given application create a new employee and add the following checkpoints:
Standard Checkpoint
Bitmap Checkpoint
Text Checkpoint
Database Checkpoint
XML Checkpoint
URL :
The application URL would be provided during the training
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
What is Descriptive Programming?
An approach through which the objects under test are recognized dynamically.
This technique of scripting does not use QTP‘s Object Repository (OR) in which we
specify properties and values of the object.
The objects in the application are dynamic in nature and need special handling to
identify the object. The best example would be of clicking a link which changes
according to the user of the application, Ex. ―Logout <<UserName>>‖.
When object repository is getting huge due to the no. of objects being added
leading to decreased performance of Object Identification.
Modification to a test case is needed but the Object repository for the same is Read
only or in shared mode i.e. changes may affect other scripts as well.
When we have to work with different methods and the different actions have
different ORs.
When we are not able record certain specific object e.g. hidden panels, Objects
with changing hierarchies, Nested inner-object, Sub Menus etc.
When we say .ChildObjects(Desc), it finds the collection of all the Images on the
page having the properties defined previously.
The following code assigns the value to the first object out of the object collection of
WebEdit class defined by the properties:
Obj_oDesc("micclass").Value = “WebEdit”
Obj_oDesc(“name”).Value = “user_name”
Lists(0).Set “posManager”
The following line of code sets the value of the username edit box:
Demonstration
Motive: Write a script to log on to the EPOS Manager Application using the two
methods of descriptive programming
Exercise:
Introduction Internal
Modes of Recording
Object Repository
Actions, Parameterizations, Paths & Conditions
Function Library
CheckPoints
Descriptive Programming
Glossary
Glossary : Msgbox & Print
Msgbox : Displays a message in a dialog box, waits for the user to click a button.
Print : Displays information in the QuickTest Print Log window during the run session. The QuickTest Print
Log window remains open while the run session continues, until we close it.