Thursday, 16 May 2013

About Expert View in QTP


The expert view displays the VBScript code that corresponds to the steps that one has created for the AUT (Application Under Test) or for a particular business flow.

Purpose of Expert View:

1. To Execute different steps depending on the business flow or Functionl flow.
2. To perform some comparisons Eg: Validation of actual values and expected values.
3. To retrieve information of Run-time Objects.
4. Statement Completion feature presents options for finishing the current vb script line. The feature is useful in several contexts:
i. When you type an object followed by an open paranthesis, QTP displays a list of all test objects of that class in the object repository.
ii. When you type a dot after an object, QTP displays a list of available child objects and methods for the objecct you typed.
iii. When you type a method, QTP displays the syntax and arguments for the method.
5. Also helps in expanding VB Script Syntax
6. Also Provide Context sensitive help

Why Debugging?


once creation of script(s) got completed, to ensure the script is free of errors one has to perform debugging.

Purpose of Debugging:
1. To Find syntax errors.
2. To Add Breakpoints.
3. To Execute single line of step(s).

QTP will check your script for syntax errors whenever you switch from the Expert view to Keyword View. The SYNTAX Error window displays the following information for each error in the script.
Break Points allow user to suspend a run session at a pre-determined place in the script in order to inspect the run time state of application.
The step commands in the DEBUG menu allow user to execute a single step of a script, these commands are available once a run session has paused.

About Test Object and Runtime Objects


Whenever we record a real-world object (also known as a Runtime object), QTP creates a corresponding Test Object and stores it in the Object Repository. The Test Object contains QTP specific properties and methods which allow us both to identify the relevant runtime object during playback, as well as to perform standard operations on it and with it.
For example, a Window test object contains properties which allow QTP to identify it in the "real world": text, height, nativeclass, etc.; on top of these, it also contains methods to operate it: Close, Click, Maximize. We can easily see these methods and properties via the object spy’s Test Object tab.

It is important to understand that the test object’s properties and methods are not really "out there" in the application’s runtime object, but are only derived from it. So for example, a SwfComboBox Test Object has the property "all items", while the actual .net application combobox runtime object has no such property. QTP builds the "all items" property out of the combobox runtime object’s available items collection, so even though the property does not exist in the runtime object, it is derived from it.


Test objects play several roles in QTP, the most immediate one is object identification. By using a window test object with a text property of "Notepad", we tell QTP to look for a runtime window object with text = "Notepad".
Another important role is standardization. While the application runtime objects might be extremely complex, the corresponding QTP test objects are standard and very simple in comparison. The test object’s simple properties and methods act as a bridge, sparing us the need to nitpick our way through the runtime object’s unknown commands, events and properties. QTP will translate the test object’s simple commands to the runtime object’s commands required to perform the task at hand.

For example, selecting a value in a .Net combobox usually involves changing several properties (SelectedIndex, SelectedItem), and raising several events (SelectionChanged, ItemSelected, TextChanged, etc.). However, the corresponding SwfComboBox test object provides a much more simple and standard "Select" method which does the trick for you.
Working with Test Objects

How can we work with test objects in our scripts?

The most straight-forward way is to simply use them. Every time we maximize a window, select a value from a VBComboBox or click a WebElement, we do it through the QTP test objects. QTP will then locate the corresponding "real" runtime object, and perform the relevant action on it. We can either use prerecorded test objects from the object repository, or create instant test objects via Descriptive Programming.
Aside from straightforwardly using our test objects to perform actions, there are 4 special commands which allow us to access the core of QTP’s test object mechanism: GetTOProperty, GetTOProperties, SetTOProperty and GetROProperty.
GetTOProperty allows us to retrieve the value of a test object property. For example, this command will print out "Notepad":
Msgbox Window("text:=Notepad").GetTOProperty("text")
The GetTOProperty command will retrieve the value as it was originally recorded (or created via DP). It does not matter if the corresponding runtime object exists, or if that value was updated in "the real world" since the object was recorded.

Complete List of new features that are available in QTP 11


XPath and CSS based object identification

Identify objects not only using normal object identification but with XPath and CSS identifier properties. A much awaited and a killer feature

Good Looking and Enhanced Results Viewer

The new improved results viewer provides an executive summary page with summary data, pie charts and statistics for both the current and previous runs and a quick link to the previous run results.
Easy Regular Expressions

You can now create reg ex with the help of syntax hints. Regular Expression Evaluator is available to test regular expressions that you have created. Good One.

Now identify objects not only in relation to each other but in relation to neighboring objects.

With this feature, QTP 11 has moved beyond the unreliability of ordinal identifiers. Objects identified with ordinal identifiers are good only as long as they maintain their relative positions with respect to each other in the new build of application. In case if this position changes or gets interchanged, ordinal identifiers may go for a toss.

HP has now introduced Visual Relation Identifier.

A visual relation identifier is a set of definitions that enable you to identify the object in the application according its neighboring objects in the application. You can select neighboring objects that will maintain the same relative location to your object, even if the user interface design changes. You define visual relations in the Visual Relation Identifier dialog box, which is accessible from the local or shared object repository, and from the Object Properties dialog box.

Load Function Libraries at Run Time

With the help of LoadFunctionLibrary statement. You can now load a function library when a step runs instead of at the beginning of a run session.

Record Support

For FireFox is now available.

Best Log Tracking is available now

QTP 11 is capable of receiving Java or .NET log framework messages from your application which can then be embedded in the run results.

Embed/Run Javascript in web pages

You can use the new EmbedScript/EmbedScriptFromFile and RunScript/RunScriptFromFile functions to embed JavaScripts in all loaded browser pages. You can use these scripts to perform operations on, or retrieve data from, the browser pages in your application.

Manage Test Data

Improved test data management when integrated with Quality Center

Support for Web 2.0 Toolkit Applications

QTP 11 now supports Web 2.0 Toolkit Applications out-of-the-box similar to any other add-ins.

Automatically Parameterize Steps

You can instruct QTP 11 to automatically parameterize test steps at the end of record session.

Extend WPF and Silverlight Support

You can use WPF and Silverlight Add-in Extensibility SDK to develop support for testing third-party and custom WPF and Silverlight controls that are not supported out-of-the-box

To test objects in Silverlight 2 and Silverlight 3 applications. [After installation, Silverlight Add-in is displayed in the Add-in Manager as a child add-in under the WPF Add-in]

Recording Modes in QTP


QTP supports 3 types of recording modes

1) Context Sensitive
2)Analog
3) Low Level

Context Sensitive Recording mode
Normal recording mode is also called Context Sensitive Mode
It is the default mode of recording which takes full advantage of Quick Test Professional's test object model.
It recognizes objects in application regardless of their location on the screen.
It records the objects in your application and the operations performed on them

Analog Recording Mode
In analog recording mode, Quick Test Professional records and tracks every movement of the mouse as you drag the mouse around a screen or window.
QTP’s Analog recording is captured as Tracks and stored in the directory of your test
It is useful for recording operations that cannot be recorded at the level of an object. Eg., A signature produced by dragging the mouse
In Analog mode you can record 1) Record Relative to screen & 2) Relative to window
When your analog operation are confined to just one window , use relative to window
When your analog operation involve multiple screens like dragging and dropping an object from one window to other use the screen option

Low Level Mode
This mode enables you to record on any object in your application, irrespective of QTP recognizes the specific object or the specific operation.
This mode records at the object level and records all run-time objects as either Window or WinObject test objects..
It is used when the exact coordinates of the object are important for your tests. A good example would be hashmaps where clicking different sections of a picture takes you to different links
Used when recording tests in an environment (or on an object) not recognized by QTP
Low level mode records the x,y coordinates of any clicks

Summary
Analog recording and low-level recording require more disk space than normal recording mode.
For both modes , screen positions during the record and run time needs to be identical otherwise script fails
Hence, Use analog recording or low-level recording only when normal recording mode does not accurately record your operation.
At times QTP automatically switches to low level mode while recording objects or environments not supported by QTP

Differences between Wait, Wait Property and Exist


1. Wait Statement: It will wait for the specified amount of time. We can specify the time in both seconds and milliseconds. But its necessary to define time in the wait statement even it is zero otherwise it will give you an error.

Example: wait, wait () both will give errors
while wait(0), wait 0, wait 0, 10000 are valid statements.

also wait (0, 10000) will give an error and wait 0,10000 is a valid statement.

The disadvantage of wait statements is that it is not applied on a condition. If this statements is encountered by the compiler then it will wait for the specified amount of time.

2. Exist Property: A very useful property when dealing with the dynamic objects which takes time to download on the web pages.As the name suggests this property checks if a objects exist before doing operations on the object. This property can be used almost all the objects. It is used as follows:

A=Browser("").Page("").Frame("").webedit("Login").exist(09)

The above exist statement will check if the "Login" object exists on the WebPage or not. If it exist then it return True to "A: and if not then it will return False to "A". In real time we generally checks if some objects exist or not before doing some operation on it.

Example:

If Browser("JobCenter").Page("JobCenter").WebButton(strKeywordName).Exist(10) then Browser("JobCenter").Page("JobCenter").WebButton(strKeywordName).Click end if

Difference between wait and Exist Statement:

1. Execution will wait specifically for the amount specified in Wait statement. If wait(10) is define then the QTP will wait for 10 seconds. No matter what happens. So if we have a script which run 100 time then naturally it is going to increase the run time significantly.
Exist: Execution will move to next statement as soon as Exist return a True. So if Exist(10) is specified and the condition become true on the very first second then QTP will move to next statement. Thus we have directly saved the 9 second.

2. Wait is a statement while Exist is a property. By then help of wait we pause the execution for certain amount of time while Exist checks if a specified objects exists or not for the specified time.

3. WaitProperty – method is used to instruct QTP to wait the execution process until it matches with the object property value based on the specified time.

E.g. Browser("Welcome: Mercury Tours").WaitProperty "name" "Welcome: Mercury Tours" 5000
Here name is - property name , Welcome: Mercury Tours is - property value, 5000 - number of milli seconds to wait

Differences between CheckPoint and Output Value


Check points are bascilly used for validation purpose. Checkpoint compares the expected result of the Test object with the Actual result from the run time object and returns a pass or fail to the test result.

Output values enable to view the values that the application takes during run time.When paramaterised, the values change for each iteration.Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.

Difference between Image Checkpoint & Bitmap Checkpoint, Actions & Functions


Image Checkpoint
Image checkpoint is used to check the “Property Values” of an image. You can verify different properties like destination address, image type etc.
You can create an image checkpoint using the standard checkpoint on an image object.

Bitmap Checkpoint
Bitmap checkpoint lets you check an area of a web page or an application after capturing it as a bitmap so that it can compare the expected the expected and actual bitmap and find out inconsistencies.
You can create bitmap checkpoint using “Bitmap Checkpoint” (Insert > Checkpoint > Bitmap Checkpoint)



Actions

Functions


Actions, accept only Primitive data-types as parameters (E.g. strings, integers… etc…)

Functions accept arrays, dictionary objects and test objects (E.g. Pages, Frames, WebRadioGroups, etc.)


Actions can hold, Data table sheets for parameterization, Active screen to apply check points, Object repositories (Local [Per Action] and Shared).

There’s the code contained in the Function, and that’s all.


Call to existing actions, cannot be done through QTP API

Call to existing functions through QTP API is possible.


Reading output/return values from Actions are difficult to handle.

Easy to read and handle.

What is parametrization? How many parametrization types are available with QTP?


Parametrization is a process of replacing all the constants within the test script into variables (parameters) so that we can reuse the same script with different sets of test data.

Types of Parametrization in QTP:
---------------------------------
1) Test/Action Parameters (Input Parameters, Output Parameters)
2) Environment variables (Built-in Variables, Internal Variables, External variables)
3) DataTable Parameters (Global Sheet Parameters, Local Sheet Parameters, Run-time table Parameters)
4) Random Number Parameters

Ways to count objects in QTP


4 ways to get & count objects in QTP
Imagine simple and practical QTP tasks:
How to count all links on Web page?
How to get them and click each link?
How to get all WebEdits and check their values?

I'm going to show 4 approaches how to get lists of UI controls and process them (for example get their count).
As an example, I will work with links on Google Labs page. My goal is to get the list of links and count them.

I've added Google Labs page to my Object Repository and now it looks like:
I use Object Repository (OR) to simplify my demo-scripts.
Since the browser & the page were added to OR, we can use them later like:
Browser("Google Labs").Page("Google Labs").

Now we are ready to start!

QTP Descriptive Programming (QTP DP) and ChildObjects QTP function
The approach uses Description object, which contains a 'mask' for objects we would like to get.
QTP script is:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Links = Browser("Google Labs").Page("Google Labs").ChildObjects(oDesc)
Msgbox "Total links: " & Links.Count
The result of this QTP script is:
ChildObjects returns the collection of child objects matched the description ("micclass" is "Link") and contained within the object (Page("Google Labs")).

Object QTP property and objects collections
QTP can work with DOM:
Set Links = Browser("Google Labs").Page("Google Labs").Object.Links
Msgbox "Total links: " & Links.Length
I use Object property of Page object. It represents the HTML document in a given browser window.
This document contains different collections - forms, frames, images, links, etc.
And we use Length property to get the number of items in a collection.

The result is the same as for the previous QTP script:

Object QTP property and GetElementsByTagName method
Again, we can get access to the HTML document and use its GetElementsByTagName method.
As the name says, GetElementsByTagName method returns a collection of objects with the specified tag.
Since we are going to get all link, we should use "a" tag.

QTP script is:
Set Links = Browser("Google Labs").Page("Google Labs").Object.GetElementsByTagName("a")
Msgbox "Total links: " & Links.Length
The result is the following:

Note: There is another way how to select objects by tag name:
Set Links = Browser("Google Labs").Page("Google Labs").Object.all.tags("a")
Msgbox "Total links: " & Links.Length
The result will be the same. 69 link will be found.

XPath queries in QTP
The idea of this approach is to use XPath queries on a source code of Web page.
For example, "//a" XPath query returns all "a" nodes (= links) from XML file.

There is one problem. Web page contains HTML code, which looks like XML code but actually it is not.
For example:
HTML code can contain unclosed img or br tags, XML code cannot.
HTML code is a case-insensitive markup language, XML is a case-sensitive markup language, etc
More details here.

So, we have to convert HTML source code into XML. The converted code is named as XHTML.

You can convert HTML documents into XHTML using an Open Source HTML Tidy utility.
You can find more info about how to convert HTML code into XHTML code here.

I will use the final QTP script from this page, a bit modified:
' to get an HTML source code of Web page
HtmlCode = Browser("Google Labs").Page("Google Labs").Object.documentElement.outerHtml

' save HTML code to a local file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile("C:\HtmlCode.html", True, -1)
f.Write(HtmlCode)
f.Close()

' run tidy.exe to convert HTML to XHTML
Set oShell = CreateObject("Wscript.shell")
oShell.Run "C:\tidy.exe --doctype omit -asxhtml -m -n C:\HtmlCode.html", 1, True ' waits for tidy.exe to be finished

' create MSXML parser
Set objXML = CreateObject("MSXML2.DOMDocument.3.0")
objXML.Async = False
objXML.Load("C:\HtmlCode.html")

XPath = "//a" ' XPath query means to find all links
Set Links = objXML.SelectNodes(XPath)
Msgbox "Total links: " & Links.Length
Note: you can download tidy.exe here for above QTP script.

This QTP script leads to the same results - 69 links found:

Wednesday, 15 May 2013

How to fetch Identification Properties of Objects through object Spy and progromatically


There are two ways how to get all properties of an object in QuickTest Professional:
Manually
Programmatically
Use QTP Object Spy to get manually object properties.
I've captured properties of ''Advanced Search" link from Google's page:
So, QTP Object Spy shows these values:
Using QTP Object Spy you can get Run-time Object Properties and Test Object Properties.
It's possible to get these properties programatically:
The GetTOProperty and GetTOProperties methods enable you to retrieve a specific property value or all the properties and values that QuickTest uses to identify an object.
The GetROProperty returns the current value of the test object property from the object in the application.

GetTOProperty differs from the GetROProperty method:
GetTOProperty returns the value from the test object's description.
Test Object Properties are stored in the QTP Object Repository.
GetROProperty returns the current property value of the object in the application during the test run.
QTP reads Run-time Object Properties from actual objects during the runnins can be read and accessed during the run session.

That means that when you work with objects using QTP Descriptive Programming (DP), you will be able to access run-time object properties only (using GetROProperty function). Test object properties (using GetTOProperty function) will not be accessed, because QTP DP doesn't work Object Repository.

There is a problem with Run-time object properties.
In contrast to GetTOProperties (which returns the collection of all properties and values used to identify the test object),GetROProperties function does NOT exist!
Once again - GetROProperties function does NOT exist!


Well, how to get all Object Indentification Properties of an object?
Answer: We can read them from Windows Registry.

The following registry key contains properties of a given test object:
HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\_Test_Object_\Properties

For example, I've opened:
HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Link\Properties and I've got properties of Link object:

Please note that you can find the same Link Identification Properties in QuickTest Professional Help:

QTP Object Identification Properties can be used:
in the object repository description
in programmatic descriptions
in checkpoint and output value steps
and as argument values for the GetTOProperty and GetROProperty methods

So we have to read all Identification Properties from the registry.
This QTP code reads Link Identification Properties:
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

sKeyPath = "SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Link\Properties"
oReg.EnumValues HKEY_LOCAL_MACHINE, sKeyPath, arrNames

As a result, arrNames array contains all names of properties.
To prove my words I use this QTP script:
sNames = "Identfication Properties:" & vbNewLine

For i = 0 to UBound(arrNames)
sNames = sNames & arrNames(i) & vbNewLine
Next

MsgBox sNames
The result is:
Compare these Link Identification Properties with properties from the registry. They are the same!

So, we can read names of properties.

Next step is to read their values. It can be archived using GetTOProperty or GetROProperty.
Also, I'm going to show how GetTOProperty and GetROProperty work for Test Object (located in QTP Object Repository) andRun-time Object (actual object, created during the run session).

Properties of Test Object
QTP script is:
' Link("Advanced Search") is an object from QTP Object Repository
Set TestLink = Browser("Google").Page("Google").Link("Advanced Search")

sNamesTO = "GetTOProperty for Test Object" & vbNewLine & "Identfication Properties: Values" &vbNewLine
sNamesRO = "GetROProperty for Test Object" & vbNewLine & "Identfication Properties: Values" &vbNewLine

For i = 0 to UBound(arrNames)
sNamesTO = sNamesTO & arrNames(i) & ": " & TestLink.GetTOProperty(arrNames(i)) & vbNewLine
sNamesRO = sNamesRO & arrNames(i) & ": " & TestLink.GetROProperty(arrNames(i)) & vbNewLine
Next

MsgBox sNamesTO
MsgBox sNamesRO
Test Object Properties of Test Object
Test Object Properties of Test Object and their values are:
Run-time Object Properties of Test ObjectRun-time Object Properties of Test Object and their values are:
Properties of Run-time ObjectQTP script is:
' Link("text:=Advanced Search") is a dynamic run-time object
Set TestLink = Browser("Google").Page("Google").Link("text:=Advanced Search")

sNamesTO = "GetTOProperty for Run-time Object" & vbNewLine & "Identfication Properties: Values" &vbNewLine
sNamesRO = "GetROProperty for Run-time Object" & vbNewLine & "Identfication Properties: Values" &vbNewLine

For i = 0 to UBound(arrNames)
sNamesTO = sNamesTO & arrNames(i) & ": " & TestLink.GetTOProperty(arrNames(i)) & vbNewLine
sNamesRO = sNamesRO & arrNames(i) & ": " & TestLink.GetROProperty(arrNames(i)) & vbNewLine
Next

MsgBox sNamesTO
MsgBox sNamesRO
Test Object Properties of Run-time ObjectTest Object Properties of Run-time Object and their values are:
Why almost all properties are empty?

As I said, GetTOProperty function gets values from Test Object, which is stored in QTP Object Repository. Since Run-time Object is a dynamic object, it's not stored in QTP Object Repository. That's why GetTOProperty function cannot read object's properties.

Look at the above screenshot again. The only one property ('text') contains its value ('Advanced Search'). We used this property to create description for our link:
Set TestLink = Browser("Google").Page("Google").Link("text:=Advanced Search")
That's why this Run-time Object contains the only property.
Run-time Object Properties of Run-time ObjectRun-time Object Properties of Run-time Object and their values are:
As you can see, we got the same Run-time Object Properties both for Test Object and for Run-time Object. I can explain it.
During the run session, QTP creates a Run-time copy of Test Object. That's why Run-time Object Properties were the same for Test Object and Run-time Object.

Sample code to close all browsers which are in open state through DP


Closing browsers through Descriptive Programming
--------------------------------------------------------------
While Browser("CreationTime:=0").Exist
Browser("CreationTime:=0").Close
Wend


bIndex = 0 'Set Browser index to 0
While Browser("CreationTime:="&bIndex).Exist(1) 'Loop untill the last browser
bTitle = Browser("CreationTime:="&bIndex).GetROProperty("title") 'Get the browser title
If InStr(bTitle,"Google") = 0 And InStr(bTitle,"Yahoo") = 0 And InStr(bTitle,"Gmail") = 0 Then
Browser("CreationTime:="&bIndex).Close 'If the title doesn't contain Google or Gmail or Yahoo, close it
If bIndex <> 0 Then
bIndex = bIndex - 1 'If browser index is more than 0 and a browser is closed, decrease the index value by 1
End If
Else
bIndex = bIndex + 1 'If no browser is closed for certain run, increase the index value by 1
End If
Wend

Through Tool (QTP)
-------------------------
Go to Tools-->Options-->Web

Here you can see an option "Ignore the following browsers" where you can add your required browser details which QTP will ignore during record/run.

Using HWND:
------------------
Dim HWND: HWND = Browser( "title:=Google" ).GetROProperty( "HWND" )
SystemUtil.CloseProcessByHWND HWND

Using Process ID:
----------------------
PID = Browser("title:=Google").GetROProperty("process id")
SystemUtil.CloseProcessByID PID

Source: Internet

Maximize and Minimize browser using DP



Minimizing the browser
----------------------------
hWnd = Browser("browser_name").GetROProperty("hwnd")
Window("hwnd:=" & hWnd).Minimize


Maximizing the browser

----------------------------

hWnd = Browser("browser_name").GetROProperty("hwnd")
Window("hwnd:=" & hWnd).Maximize

Capturing hwnd
-------------------
hWnd = Browser("hwnd:=" & hWnd).Object.hWnd


When to use Descriptive Programming?


1. When Object properties are dynamic. (E.g. Ticket purchase - No one passenger will bought same number of tickets)
2. When the size of object repository is getting very large or exceeding more than 2 MB.
3. When there is no Object Repository. (E.g. When an application is in development stage)
4. When you try to access same type of objects, in large number (E.g. Selecting each and every link in Yahoo site)

Ordinal Identifier


The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.

Changes in the layout or composition of your application page or screen could cause this value to change, even though the object itself has not changed in any way.

In general, there are two types of ordinal identifiers:

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.

The Web Browser object has a third ordinal identifier type:

Creation Time — Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. Each test object class has a default ordinal identifier selected.

To modify the selected ordinal identifier, select the desired type from the Ordinal identifier box.

Configuring & Understanding the Smart Identification Process


Configuring Smart Identification properties enables you to help QuickTest identify objects in your application even if some of the properties in the object’s recorded description have changed.

When QuickTest uses the recorded description to identify an object, it searches for an object that matches every one of the property values in the description. In most cases, this description is the simplest way to identify the object and unless the main properties of the object change, this method will work.

 If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description, and uses the Smart Identification mechanism to try to identify the object.

While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QuickTest identify an object, if it is present, even when the recorded description fails.

The Smart Identification mechanism uses two types of properties:

Base filter properties—The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link’s tag was changed from to any other value, you could no longer call it the same object.

Optional filter properties—Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

Understanding the Smart Identification Process

QuickTest “forgets” the recorded test object description and creates a new object candidate list containing the objects (within the object’s parent object) that match all of the properties defined in the base filter property list.

From that list of objects, QuickTest filters out any object that does not match the first property listed in the Optional Filter Properties list. The remaining objects become the new object candidate list.

QuickTest evaluates the new object as:

If the new object candidate list still has more than one object, QuickTest uses the new (smaller) object candidate list to repeat step 2 for the next optional filter property in the list.

If the new object candidate list is empty, QuickTest ignores this optional filter property, returns to the previous object candidate list, and repeats step 2 for the next optional filter property in the List.

If the object candidate list contains exactly one object, then QuickTest concludes that it has identified the object and performs the statement containing the object.

QuickTest continues the process described in steps 2 and 3 until it either identifies one object, or runs out of optional filter properties to use.

If, after completing the Smart Identification elimination process, QuickTest still cannot identify the object, then QuickTest uses the recorded description plus the ordinal identifier to identify the object.

If the combined recorded description and ordinal identifier are not sufficient to identify the object, then QuickTest stops the test run and displays a Run Error message.