Normal Identification
The following properties of the object are used in case of normal identification:
1) Mandatory Properties
2) Assistive Properties
Mandatory Properties
These are the main identification properties for an object.
How to obtain the Mandatory Properties of an object:
MandatoryProperties Property
Description:
Returns the collection representing the list of editable mandatory properties from the Object Identification dialog box.
Syntax:
object.MandatoryProperties
Syntax Details:
| Argument | Description |
| object | An expression evaluating to an object of type TestObjectClassIdentification. |
Value Type:
Read-only. A MainIdentificationProperties object.
Method Name | Return Type | Syntax | Description |
Add | A Long Value | object.Add (PropertyName) | Adds the specified property to properties list |
Find | A Long value.This method returns -1 if the specified property is not found. | object.Find (PropertyName) | Returns the position of the specified property |
Remove | A Long Value | object.Remove (Item)Item - Required. A Variant value. The name or position of the property item you want to remove from the list. Position values start with 1. Required. A Variant value. The name or position of the property item you want to remove from the list. Position values start with 1. | Removes the specified property from the properties list |
RemoveAll | A Long Value | object.RemoveAll | Removes all editable properties from the properties list |
| Count | The number of editable properties in the list. |
| Item | The property located in the specified position. |
Assistive Properties
These are the additional identification properties for an object.
How to obtain the Assistive Properties of an object:
AssistiveProperties Property
Description
Returns the collection representing the list of assistive properties from the Object Identification dialog box.
Syntax
object.AssistiveProperties
Syntax Details
| Argument | Description |
| object | An expression evaluating to an object of type TestObjectClassIdentification. |
.
Value Type
Read-only. An AdditionalIdentificationProperties object.
Methods:
| Method Name | Syntax | Return Value | Description |
| Add | object.Add (PropertyName, [Position]) object - An expression evaluating to an object of type AdditionalIdentificationProperties. PropertyName - Required. A String value. The property to add. Position - Optional. A Long value. The location where you want to add the property within the list. The position of the first property in the list is 0. | A Long value. | Adds the specified property to the properties list. |
| Find | object.Find (PropertyName) | A Long value. This method returns -1 if the specified property is not found. | Returns the position of the specified property. |
| MoveToPos | object.MoveToPos (Item, NewPosition) Item - Required. A Variant value. The name or position index of the property you want to move. Index values begin with 0. NewPosition - Required. A Long value. The location to which you want to move the property within the list. The position of the first property in the list is 0. | A Long value. | Moves the property to the specified position. |
| Remove | object.Remove (Item) Item - Required. A Variant value. The name or position index of the property you want to remove from the list. | A Long value. | Removes the specified property from the properties list. |
| RemoveAll | object.RemoveAll | A Long value. | Removes all editable properties from the properties list. An editable property is one that you are allowed to add, remove, or move within the list. Some properties, such as the test object class, are not editable. |
| Count | The number of editable properties in the list. |
| Item | The property located in the specified position. |
Example
Configure Object Identification Settings
'************************************************************************************************************************
'Description:
'
'This example opens QuickTest and configures the Object Identification settings for the WinList test object class.
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtIdent 'As QuickTest.ObjectIdentification ' Declare the ObjectIdentification object variable
Dim qtWinListIdent 'As QuickTest.TestObjectClassIdentification ' Declare the variable for the WinList object class identification
Dim intPosition ' Declare a variable for storing positions
' Open QuickTest and set variables
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
Set qtIdent = qtApp.Options.ObjectIdentification ' Return the ObjectIdentification object
Set qtWinListIdent = qtIdent.Item("WinList") ' Return the collection of object identification properties for the WinList object class
qtIdent.ResetAll ' Reset the Object Identification description for the WinList object to the default property set
qtWinListIdent.OrdinalIdentifier = "Index" ' Set Index as the ordinal identifier
' Configure the Mandatory Properties
intPosition = qtWinListIdent.MandatoryProperties.Find("nativeclass") ' Find the location of the "nativeclass" mandatory property
qtWinListIdent.MandatoryProperties.Remove intPosition ' Remove the "nativeclass" mandatory property from the list
If qtWinListIdent.AvailableProperties.Find("items count") <> -1 Then ' If "items count" is an available identification property for WinList
qtWinListIdent.MandatoryProperties.Add "items count" ' Add it as a mandatory property
End If
' Configure the Assistive Properties
qtWinListIdent.AssistiveProperties.RemoveAll ' Remove all assistive properties
qtWinListIdent.AssistiveProperties.Add "all items" ' Add the "all items" property as an assistive property
qtWinListIdent.AssistiveProperties.Add "width", 1 ' Add "width" as the first assistive property
qtWinListIdent.AssistiveProperties.Add "height", -1 ' Add "height" as the last assistive property
qtWinListIdent.AssistiveProperties.MoveToPos 2, 1 ' Move the second assistive property (currently "all items") to the first position in the list
' Configure the Smart Identification
qtWinListIdent.EnableSmartIdentification = True ' Enable the smart identification mechanism for the WinList object
If qtWinListIdent.BaseFilterProperties.Count = 0 Then ' If there are no Base Filter properties
qtWinListIdent.BaseFilterProperties.Add "x" ' Add the "x" property as a base filter property
qtWinListIdent.BaseFilterProperties.Add "y" ' Add the "y" property as a base filter property
End If
qtWinListIdent.OptionalFilterProperties.Add "abs_x", 1 ' Add "abs_x" as the first optional filter property
qtWinListIdent.OptionalFilterProperties.Add "abs_y", 2 ' Add "abs_y" as the second optional filter property
Set qtWinListIdent = Nothing ' Release the WinList identification object
Set qtIdent = Nothing ' Release the ObjectIdentification object
Set qtApp = Nothing ' Release the Application object
Smart Identification
The following properties of the object are used in case of smart identification:
1) Base filter Properties
2) Option filter properties
Base filter Properties
These are the main identification properties for an object.
How to obtain the Base filter Properties of an object:
BaseFilterProperties Property
Description:
Returns the collection representing the list of editable base filter properties from the Smart Identification dialog box.
Syntax:
object.BaseFilterProperties
Syntax Details:
| Argument | Description |
| object | An expression evaluating to an object of type TestObjectClassIdentification. |
Value Type:
Read-only. A MainIdentificationProperties object.
Method Name | Return Type | Syntax | Description |
Add | A Long Value | object.Add (PropertyName) | Adds the specified property to properties list |
Find | A Long value.This method returns -1 if the specified property is not found. | object.Find (PropertyName) | Returns the position of the specified property |
Remove | A Long Value | object.Remove (Item)Item - Required. A Variant value. The name or position of the property item you want to remove from the list. Position values start with 1. Required. A Variant value. The name or position of the property item you want to remove from the list. Position values start with 1. | Removes the specified property from the properties list |
RemoveAll | A Long Value | object.RemoveAll | Removes all editable properties from the properties list |
| Count | The number of editable properties in the list. |
| Item | The property located in the specified position. |
Option filter properties
These are the additional identification properties for an object.
How to obtain the Option Filter Properties of an object:
OptionalFilterProperties Property
Description
Returns the collection representing the list of optional filter properties from the Smart Identification dialog box.
Syntax
object. OptionalFilterProperties
Syntax Details
| Argument | Description |
| object | An expression evaluating to an object of type TestObjectClassIdentification. |
.
Value Type
Read-only. An AdditionalIdentificationProperties object.
How to set the Optional filter properties for an object:
Methods:
| Method Name | Syntax | Return Value | Description |
| Add | object.Add (PropertyName, [Position]) object - An expression evaluating to an object of type AdditionalIdentificationProperties. PropertyName - Required. A String value. The property to add. Position - Optional. A Long value. The location where you want to add the property within the list. The position of the first property in the list is 0. | A Long value. | Adds the specified property to the properties list. |
| Find | object.Find (PropertyName) | A Long value. This method returns -1 if the specified property is not found. | Returns the position of the specified property. |
| MoveToPos | object.MoveToPos (Item, NewPosition) Item - Required. A Variant value. The name or position index of the property you want to move. Index values begin with 0. NewPosition - Required. A Long value. The location to which you want to move the property within the list. The position of the first property in the list is 0. | A Long value. | Moves the property to the specified position. |
| Remove | object.Remove (Item) Item - Required. A Variant value. The name or position index of the property you want to remove from the list. | A Long value. | Removes the specified property from the properties list. |
| RemoveAll | object.RemoveAll | A Long value. | Removes all editable properties from the properties list. An editable property is one that you are allowed to add, remove, or move within the list. Some properties, such as the test object class, are not editable. |
| Count | The number of editable properties in the list. |
| Item | The property located in the specified position. |
Example
Configure Object Identification Settings
'************************************************************************************************************************
'Description:
'
'This example opens QuickTest and configures the Object Identification settings for the WinList test object class.
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtIdent 'As QuickTest.ObjectIdentification ' Declare the ObjectIdentification object variable
Dim qtWinListIdent 'As QuickTest.TestObjectClassIdentification ' Declare the variable for the WinList object class identification
Dim intPosition ' Declare a variable for storing positions
' Open QuickTest and set variables
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
Set qtIdent = qtApp.Options.ObjectIdentification ' Return the ObjectIdentification object
Set qtWinListIdent = qtIdent.Item("WinList") ' Return the collection of object identification properties for the WinList object class
qtIdent.ResetAll ' Reset the Object Identification description for the WinList object to the default property set
qtWinListIdent.OrdinalIdentifier = "Index" ' Set Index as the ordinal identifier
' Configure the Mandatory Properties
intPosition = qtWinListIdent.MandatoryProperties.Find("nativeclass") ' Find the location of the "nativeclass" mandatory property
qtWinListIdent.MandatoryProperties.Remove intPosition ' Remove the "nativeclass" mandatory property from the list
If qtWinListIdent.AvailableProperties.Find("items count") <> -1 Then ' If "items count" is an available identification property for WinList
qtWinListIdent.MandatoryProperties.Add "items count" ' Add it as a mandatory property
End If
' Configure the Assistive Properties
qtWinListIdent.AssistiveProperties.RemoveAll ' Remove all assistive properties
qtWinListIdent.AssistiveProperties.Add "all items" ' Add the "all items" property as an assistive property
qtWinListIdent.AssistiveProperties.Add "width", 1 ' Add "width" as the first assistive property
qtWinListIdent.AssistiveProperties.Add "height", -1 ' Add "height" as the last assistive property
qtWinListIdent.AssistiveProperties.MoveToPos 2, 1 ' Move the second assistive property (currently "all items") to the first position in the list
' Configure the Smart Identification
qtWinListIdent.EnableSmartIdentification = True ' Enable the smart identification mechanism for the WinList object
If qtWinListIdent.BaseFilterProperties.Count = 0 Then ' If there are no Base Filter properties
qtWinListIdent.BaseFilterProperties.Add "x" ' Add the "x" property as a base filter property
qtWinListIdent.BaseFilterProperties.Add "y" ' Add the "y" property as a base filter property
End If
qtWinListIdent.OptionalFilterProperties.Add "abs_x", 1 ' Add "abs_x" as the first optional filter property
qtWinListIdent.OptionalFilterProperties.Add "abs_y", 2 ' Add "abs_y" as the second optional filter property
Set qtWinListIdent = Nothing ' Release the WinList identification object
Set qtIdent = Nothing ' Release the ObjectIdentification object
Set qtApp = Nothing ' Release the Application object
Ordinal Identifier
How to obtain the ordinal identifier property for an test object:
OrdinalIdentifier Property
Description
The ordinal identifier property for the test object class.
Syntax
object.OrdinalIdentifier [= value]
Syntax Details
| Argument | Description |
| object | An expression evaluating to an object of type TestObjectClassIdentification. |
| value | A String value. |
Value Type
Read-write. A String value.
Possible Values
Index--Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.
Location--Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. Values are assigned from top to bottom, and then left to right.
CreationTime--(for Web Browser objects only) Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description.
Example
Specify the Ordinal Identifier for an Object Class
'************************************************************************************************************************
'Description:
'
'This example opens QuickTest and configures the Object Identification settings for the WinList test object class.
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtIdent 'As QuickTest.ObjectIdentification ' Declare the ObjectIdentification object variable
Dim qtWinListIdent 'As QuickTest.TestObjectClassIdentification ' Declare the variable for the WinList object class identification
Dim intPosition ' Declare a variable for storing positions
' Open QuickTest and set variables
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
Set qtIdent = qtApp.Options.ObjectIdentification ' Return the ObjectIdentification object
Set qtWinListIdent = qtIdent.Item("WinList") ' Return the collection of object identification properties for the WinList object class
qtIdent.ResetAll ' Reset the Object Identification description for the WinList object to the default property set
qtWinListIdent.OrdinalIdentifier = "Index" ' Set Index as the ordinal identifier
' Configure the Mandatory Properties
intPosition = qtWinListIdent.MandatoryProperties.Find("nativeclass") ' Find the location of the "nativeclass" mandatory property
qtWinListIdent.MandatoryProperties.Remove intPosition ' Remove the "nativeclass" mandatory property from the list
If qtWinListIdent.AvailableProperties.Find("items count") <> -1 Then ' If "items count" is an available identification property for WinList
qtWinListIdent.MandatoryProperties.Add "items count" ' Add it as a mandatory property
End If
' Configure the Assistive Properties
qtWinListIdent.AssistiveProperties.RemoveAll ' Remove all assistive properties
qtWinListIdent.AssistiveProperties.Add "all items" ' Add the "all items" property as an assistive property
qtWinListIdent.AssistiveProperties.Add "width", 1 ' Add "width" as the first assistive property
qtWinListIdent.AssistiveProperties.Add "height", -1 ' Add "height" as the last assistive property
qtWinListIdent.AssistiveProperties.MoveToPos 2, 1 ' Move the second assistive property (currently "all items") to the first position in the list
' Configure the Smart Identification
qtWinListIdent.EnableSmartIdentification = True ' Enable the smart identification mechanism for the WinList object
If qtWinListIdent.BaseFilterProperties.Count = 0 Then ' If there are no Base Filter properties
qtWinListIdent.BaseFilterProperties.Add "x" ' Add the "x" property as a base filter property
qtWinListIdent.BaseFilterProperties.Add "y" ' Add the "y" property as a base filter property
End If
qtWinListIdent.OptionalFilterProperties.Add "abs_x", 1 ' Add "abs_x" as the first optional filter property
qtWinListIdent.OptionalFilterProperties.Add "abs_y", 2 ' Add "abs_y" as the second optional filter property
Set qtWinListIdent = Nothing ' Release the WinList identification object
Set qtIdent = Nothing ' Release the ObjectIdentification object
Set qtApp = Nothing ' Release the Application object
Making Tool Settings Global
As QTP is a I-tier(Stand-alone) application,making Tool settings globally is not possible.
For making tool settings global, QTP is providing a special feature called "Generate Script".
For making tool settings global, QTP is providing a special feature called "Generate Script".
Generate Script
Generates a QuickTest automation script containing the current global testing options.
When you click the Generate Script button, a Save As dialog box opens, enabling you to specify the name and file system location to store the generated file.
You can use some or all of the script lines from this generated script in an automation script. This can be useful, for example, if you want to create an initialization script that will open QuickTest with a pre-defined set of options applied.
Sample Generated Automation Script for Global Testing Options
The QuickTest Automation script below shows a sample script that was generated using the Generate Script button in the Options dialog box. The script was generated with the Web and Java Add-ins loaded.
Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
App.Options.DisableVORecognition = False
App.Options.AutoGenerateWith = False
App.Options.WithGenerationLevel = 2
App.Options.TimeToActivateWinAfterPoint = 500
App.Options.SaveLoadAndMonitorData = True
App.Options.Run.RunMode = "Normal"
App.Options.Run.ViewResults = True
App.Options.Run.StepExecutionDelay = 0
App.Options.Run.MovieCaptureForTestResults = "Never"
App.Options.Web.AddToPageLoadTime = 10
App.Options.Web.RecordCoordinates = False
App.Options.Web.RecordMouseDownAndUpAsClick = False
App.Options.Web.RecordAllNavigations = False
App.Options.Web.RecordByWinMouseEvents = ""
App.Options.Web.BrowserCleanup = False
App.Options.Web.RunOnlyClick = False
App.Options.Web.RunMouseByEvents = True
App.Options.Web.RunUsingSourceIndex = True
App.Options.Web.EnableBrowserResize = True
App.Options.Web.PageCreationMode = "URL"
App.Options.Web.CreatePageUsingUserData = "Get Post"
App.Options.Web.CreatePageUsingNonUserData = ""
App.Options.Web.CreatePageUsingAdditionalInfo = True
App.Options.Web.FrameCreationMode = "URL"
App.Options.Web.CreateFrameUsingUserData = "Get Post"
App.Options.Web.CreateFrameUsingNonUserData = ""
App.Options.Web.CreateFrameUsingAdditionalInfo = True
App.Options.Java.RecordListByIndex = False
App.Options.Java.RecordComboByIndex = False
App.Options.Java.RecordTreeByIndex = False
App.Options.Java.RecordTabByIndex = False
App.Options.Java.AWTEventModel = "Auto"
App.Options.Java.AnalogTableRecording = False
App.Options.Java.TreePathSeparator = ";"
App.Options.Java.TableExternalEditors = ""
App.Options.Java.TableInternalEditors = ""
App.Options.WindowsApps.AttachedTextRadius = 35
App.Options.WindowsApps.AttachedTextArea = "TopLeft"
App.Options.WindowsApps.ExpandMenuToRetrieveProperties = True
App.Options.WindowsApps.NonUniqueListItemRecordMode = "ByName"
App.Options.WindowsApps.RecordOwnerDrawnButtonAs = "PushButtons"
App.Options.WindowsApps.ForceEnumChildWindows = 0
App.Options.WindowsApps.ClickEditBeforeSetText = 0
App.Options.WindowsApps.VerifyMenuInitEvent = 0
App.Options.TextRecognitionOrder = "APIThenOCR"
App.Options.TextRecognitionBlockType = "Multiple"
App.Options.TextRecognitionLanguages = "English"
App.Options.DisplayKeywordView = True
App.Folders.RemoveAll
App.Folders.Add("C:\Temp\MyTests")
STEPS :
1) Generate script is available in 3 areas.
a) File->Settings
b) Tools->Options
c) Tools->Object Identification
2) Perform required settings and generate Scripts
3) Share Script files to team members and ask them to execute those scripts.
NOTE: After executing these scripts all team members can get same settings.
Virtual Object Configuration
Virtual Object
Your application may contain objects that behave like standard objects but are not recognized by QuickTest.
You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. QuickTest emulates the user's action on the virtual object during the run session. In the run results, the virtual object is displayed as though it is a standard class object.
For example, suppose you want to test a Web page containing a bitmap that the user clicks. The bitmap contains several different hyperlink areas, and each area opens a different destination page. When you create the test, the Web site matches the coordinates of the click on the bitmap and opens the destination page.
To enable QuickTest to click at the required coordinates during a run session, you can define a virtual object for an area of the bitmap, which includes those coordinates, and map it to the button class. When you run the test, QuickTest clicks the bitmap in the area defined as a virtual object so that the Web site opens the correct destination page.
Virtual object collections are groups of virtual objects that are stored in the Virtual Object Manager under a descriptive name.
The virtual object collections displayed in the Virtual Object Manager are stored on your computer and not with the tests that contain virtual object steps. This means that if you use a virtual object in a test step, the object will be recognized during the run session only if it is run on a computer containing the appropriate virtual object definition. To copy your virtual object collection definitions to another computer, copy the contents of your <QuickTest installation folder>\dat\VoTemplate folder (or individual .vot collection files within this folder) to the same folder on the destination computer.
Note: QuickTest does not support virtual objects for analog or low-level recording.
Virtual Object Manager
From the Virtual Object Manager, you can define and delete virtual objects and collections. The Virtual Object Manager dialog box enables you to view and manage the virtual object collections defined on your computer.
Navigation Path:
Select Tools > Virtual Objects > Virtual Object Manager.
User interface elements are described below:
Defining a Virtual Object
Virtual Object Wizard
- Mapping it to a standard class
- Marking its boundaries
- Assigning it a parent object
- Specifying its name and grouping objects into collections
Navigation path to Virtual Object Wizard:
Use one of the following:
- Select Tools > Virtual Objects > New Virtual Object.
- Select Tools > Virtual Objects > Virtual Object Manager. From the Virtual Object Manager, click New.
Wizard map
This wizard contains:
Welcome > Map to a Standard Class > Mark Virtual Object > Object Configuration > Save Virtual Object
Map to a Standard Class Page (Virtual Object Wizard)
This wizard page enables you to configure a standard class for the virtual object.
User interface elements are described below:
Mark Virtual Object Page (Virtual Object Wizard)
This wizard page enables you to configure the size and location of the virtual object.
- Make sure that the virtual object does not overlap any other virtual object, as this may prevent QuickTest from identifying the virtual object during a run session.
- To record and run tests properly, you must ensure that the application window is the same size and in the same position as it was when you defined the virtual object.
Object Configuration Page (Virtual Object Wizard)
This wizard page enables you to configure an object as a parent of the virtual object.
User interface elements are described below:
Save Virtual Object Page (Virtual Object Wizard)
This wizard page enables you to configure a name and a collection for the virtual object. It also enables you to begin defining another virtual object.
Removing or Disabling Virtual Object Definitions
From the Virtual Object Manager, you can delete virtual objects and collections.
No comments:
Post a Comment