QTP Tutorial #23 – QTP Smart Object Identification, Sync Point, and Test Result Analysis

In this QTP tutorial we will learn – Smart Object identification, adding Synchronization point, Running a test and viewing the results, and Silent Test runner.

Smart Identification:

Assume a situation when no object matches or multiple objects match the recorded description for an object during run time, how does QTP handle it?

QTP has a mechanism in place for cases exactly like this. If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined (and enabled) for the object, QTP tries

to identify the object using “Smart identification”.

Let us see how this works with some examples.  For every object there are Primary Properties and Secondary properties.

Example 1: Object with the recorded description is not found.

On a page there was a button and the following are properties:
a) Primary: Name
b) Secondary: Abs x,y

While recording the “Name” property was “Login ID”. Due to some changes to the application, the “Name” property is now changed to “User ID”. In this case, QTP will find a button with a different description and it should fail if it considers the primary properties alone.

But in cases like this when the primary properties don’t match then it checks the secondary ones and if they match it recognizes the object. In this case, it is going to recognize the button by its X and Y co-ordinates.

Example 2: QTP was supposed to find a page X and there are 2 pages with similar browser settings.

In this case too, it tries to use the “name” or other properties to find the right page/pages and works accordingly.

The above 2 are examples of cases where QTP engages the smart identification mechanism.

  • The Test results will also show if a step employed Smart identification to run successfully.
  •  If QTP cannot find the object despite Smart Identification, then the test fails.

For most of the objects, QTP provides a default Base filter properties (Primary) and Optional filter properties (Secondary) that it checks if we enable Smart identification for them. The user does have an option to edit what properties to consider too. To do so, go to “Tools->Object Identification”. Choose the relevant Environment from the drop down and choose the Object Class. Once you chose it, check the “Enable Smart Identification” and click “Configure”.

Smart identification

Click Add or Remove

Smart identification

Select the properties as required:

Smart identification

Make your selection and Click OK when done.

Smart identification

The above process will ensure that the next time it has difficulty identifying an object of this class, it will employ smart identification to do so.

Also, for most of the objects “Smart identification” is turned ON by default. You can see where this is the case for a certain object by accessing it in the OR under “Additional details” part of its object properties.

It is set to “True” if enabled and “False” if disabled.

You could also choose to enable or disable Smart identification entirely for a test run. Choose “File->Settings->Run->Disable Smart Identification during the run session” option.

Synchronization point:

Consider this program,

SystemUtil.Run "iexplore.exe", "http://www.gmail.com"
Browser("Gmail: Email from Google").page("Gmail: Email from Google").Sync
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "swatiseela"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure "sfgs686898"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click
Browser("Gmail: Email from Google").Page("Gmail - Inbox").Link("Sign out").Click

In an ideal world, as soon as you hit the “Sign in” button in the gmail login page, the “Inbox” should get displayed without any delays. That means, the state of the application is ready for the last statement in our example to be executed immediately after the last but one statement runs.

But in real time, due to many reasons applications don’t always load at the same pace. If we do not instruct QTP to wait a certain while before it moves on. More specifically until an object attains a certain state.

A synchronization point is used to instruct QTP to wait until a particular object property achieves the value you specify.

On inserting a sync point a “Wait Property” statement is inserted into the test.

Browser("Gmail: Email from Google").Page("Gmail - Inbox"). Link("Sign out").WaitProperty “Visibile”,true,20

So your new program is going to look something like this: (line #6 below)

SystemUtil.Run "iexplore.exe", "http://www.gmail.com"
Browser("Gmail: Email from Google").page("Gmail: Email from Google").Sync
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "swatiseela"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure "sfgs686898"
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click
Browser("Gmail: Email from Google").Page("Gmail - Inbox"). Link("Sign out").WaitProperty “Visible”,true,1000
Browser("Gmail: Email from Google").Page("Gmail - Inbox").Link("Sign out").Click

It can be inserted while recording using the menu option “Insert->Synchronization Point”.  Choose the Object to insert the sync point.

Synchronization point

Enter the value as required:

Synchronization point

This is the statement that gets inserted:

Browser("Gmail - Inbox").Page("Gmail - Inbox").Link("Sign out").WaitProperty "visible", true, 10000

Running a test

1) Automation->Run or F5 typically runs the entire test.

2) You can run a part of the test by choosing “Automation->Run Current Action” option

3) You can run a test from a certain point in your test by choosing “Automation->Run From Step” option.

4) As soon as you choose any of the above ways to run a test, you will be promoted to choose the location where you would like the test results to be stored. You can choose the folder by choosing the first option in which case, the results will be stored for every instance of the test run. But if you choose the next option, temporary folder, the results get overwritten and only the latest test run result will be stored in the folder chosen. In terms of memory, it is advisable to use the second option while testing your QTP test. Unless you want every test run results, do not choose the first option because obviously it is going to use up a lot of space.

Running a test

5) Input parameters:  If the test input parameters were defined for this test, this tab is the place where you provide them.

Running a test

6) You can also run a couple of tests all at once in a batch. QTP has a “Batch Runner” tool. It is also an external tool just like a “Password encoder tool” that we discussed earlier.

7) To launch go to “Programs > QuickTest Professional > Tools > Test Batch Runner”. Create a batch (.mtb) using icon1.

Running a test

8) Once creating a list is done, run the batch using icon2 icon. After the batch run is complete, you can view the results for each test in its default test results folder (<test folder>\res#\report).

Test results:

In our articles so far, whether we are discussing data table iteration, checkpoints, smart identification or in general the test step run , the Test results is the place you get to see whether something was successful or not.

Apart from the above, the test results can hold the screenshot of your AUT when a failure occurs. This depends on the settings at “File->Settings->Run”.

The tester can print and export test results.

To make test results more understandable the user can write his comments into the test results.

For example, if a certain condition fails in your test you might want to write in the test results that “Did not work for the value X”. You can do so by using the “reporter.reportevent” statement. The following is the syntax:

Reporter.Reportevent(Event Status,Reporter step name, details)

Event status: MicPass, MicFail,MicWarning,MicDetail, the next two parameters can be any text that helps include further detail.

If this is my statement and I run it:

reporter.ReportEvent micPass,”Swati’s First Step”,”Passed coz I told it to pass …”

The test results are going to look like this: (click to enlarge image)

Test results


Since this is not a very widely used feature, I am going to do a high level introduction here.

Typically, a test is divided into transactions when you have to measure how long it takes to run a certain section of it.

It is also used when a QTP test is to be used by Load Runner or Business Process Monitor. In either of these cases, your test has to be recorded in terms of a transaction and anything outside of it will be ignored.

You can start a transaction from QTP using “Insert->Start Transaction”. Give it a name, choose if you want it before or after the current step and choose OK.


Services.StartTransaction “TransactionTest” – Gets inserted. Now I will record a login into Gmail.com.

Once you are done recording. Choose “Insert->End Transaction”. Click OK.


Services.EndTransaction “TransactionTest” – gets inserted.

This is the code:


Now I will run this test. Let us see how the test results look. The results will show a summary in terms of time taken to finish the transaction.


Silent Test runner:

Another tool that QTP provides is the Silent Test runner. This enables the tester to run his test without having to launch QTP. It also helps simulate QTP runs from load runner and verify it compatibility with the same.

It will not work if QTP is already open and another test is running via it.

Use Start > Programs > QuickTest Professional > Tools > Silent Test Runner menu command to invoke it. Select the test and click “Run Test”

Silent Test runner

This is how it looks while running the test:

Silent Test runner

Once it is completed:

Silent Test runner

Test Run log:

Silent Test runner

The “Transaction Summary” will be activated if the test contains at least one transaction.

We have now reached the end of this tutorial and have covered quite a few miscellaneous QTP topics here. I hope this is useful to all you folks.

Please feel free to post your comments and questions.


#1 Kaushtubh

Object identification is covered nicely. We need more info on test result analysis.

#2 Swati

@Kaushtubh: Since test results are highly dependent on your test and the level of visibility a tester desires we have limited the information to the extent that is very general. Is there anything specific that you would like to know more about in the test results topic? If so, please let us know and we will surely incorporate it.

#3 jyoshna

Nice post

#4 nagaraju

useful information

Leave a Comment