All About the Apps
Showing results for 
Search instead for 
Do you mean 

A guide to Image-Based Testing with HP UFT’s “Insight”

Anonymous_User1 ‎01-29-2014 10:00 AM - edited ‎09-17-2015 02:50 PM

(This post was written by Motti Lanzkron from the UFT R&D Team)



One of the main competitive advantages of HP Unified Functional Testing (UFT) is its wide support for different technologies. In fact this is probably my most reused PowerPoint slide:


But even after supporting all of these technologies (and more), there are always technologies that that are too rare or complex to justify developing UFT support.


In order to bridge the gap, UFT 11.50 introduced Insight, an image-based form of automation. Insight uses an image in order to identify a test object and is fully integrated into UFT so it can leverage the full range of UFT capabilities such as Record, Learn and Visual Relations Identifiers to name but a few.


When creating a test we sometimes find that UFT provides good support for the whole application—except for one or two little steps. These one or two little steps may make or break the ability to automate the whole application.  In these cases, it is best to mix traditional UFT tests with a couple of Insight steps to get the best of all worlds.


The power of Insight comes from the fact that it simply requires a graphical interface—the bare minimum that any GUI system supplies. This means that Insight can be used on unsupported technologies such as Flash, or even on a remote desktop connection.


For the rest of this post I’ll use the Windows Calculator to demonstrate Insight’s capabilities. But don’t allow the simplicity of the examples to distract you from the wide scope of applications that can be automated with Insight.


The Test

Usually UFT is able to give test objects descriptive names.  This is done by looking at the test objects properties and using some heuristics to decide which properties are most likely to contain a value that will convey meaning to the test maintainer. However, an InsightObject’s description is based on an image, so UFT has no additional insight (oh the irony) into the properties of the test object and is therefore not able to give the object a descriptive name. To avoid a test that contains only objects with names that look like “InsightObject_2”, “InsightObject_3”, etc., UFT inserts the actual image of the test object into the script, which has the added benefit of making the test understandable and maintainable: 

(Tip: Double clicking the Insight image will open the test object in the object repository)



In order to activate Insight during a record session, change the Recording Mode selection to Insight Recording:



While in the Insight Recording mode, mouse operations will create an Insight step.  Keyboard actions, on the other hand, create WinObject.Type steps. The reasoning behind this is that when a mouse event occurs there are coordinates associated with it and UFT can try to understand which object was acted upon, based on the coordinates. Typing presents more of a problem since UFT cannot, in general, determine which object is in focus. Therefore, the text is associated with the top-level window in focus, for example:



Window("Calculator").WinObject("Text").Type "3"



The InsightObject does support the Type operation.  You can use this method in a test to move the focus to a specific InsightObject before typing.


Test Maintainance

Part of the power of Insight is that it captures an image that gives a good representation of the relevant object.  Unfortunately, this goal is hindered by the fact that many UI elements nowadays change their appearance when they are interacted with. If Insight captured the image of a UI element when it was hovered over, then UFT could not find it during a run session, because then the element would not be hovered over.  For this reason, when recording, Insight captures several images and determines which is the most appropriate to use according to some heuristics. There are cases in which Insight guesses incorrectly, either about which image to choose, or about the bounding rectangle of the UI element.  In these cases you can change the image UFT uses for the test object by clicking the Change Test Object Image button:


This opens an editor that lets you select a different image from the image history, resize and adjust the location of the rectangle, exclude areas within the image, and modify the test object’s click point (for more details see UFT’s documentation).


Exclude Areas

There are cases in which a UI control contains areas that change without affecting the functionality of the control, and therefore make the image less useful for identification purposes. Such areas may change at random (e.g. advertisements), be dynamically generated (e.g. weather forecasts), or contain text which is localized to different languages. By adding Excluded Areas to the image we can specify that only parts of the captured image should be matched against the application, and the other areas can safely be ignored:



Because applications tend to change over time, Insight does not use simple image matching.  Instead, Insight looks for controls that are similar to the image in the description. The best match is always used. However, there is a threshold under which images are not considered to match. If you wish to change this threshold value you can add the similarity property to the InsightObject’s description.


Descriptive Programming

Insight can be used with descriptive programming as well as via the Object Repository.  To use descriptive programming, provide a path to an image file as the ImgSrc property of the test object.




The following image file formats are supported: PNG, BMP, GIF and JPEG.



I hope this introduction to Insight object identification provides enough information on how, why and when you should start using this feature. Please let us know how useful you find Insight and what problems it solves for you by leaving a comment in the box below.

You can download HP Unified Functional Testing here.



Thanks to Motti for providing this article!


About the Author


on ‎02-16-2014 10:18 PM

can anyone tell me , in UFT tool which menu controlls test run speed...?

Test Automation
on ‎02-16-2014 11:38 PM

Nice post. Its so impressive and much informative. Thanks for sharing this wih us.


<a href="">Test Automation</a>

on ‎05-04-2014 08:13 AM

.Hi all .:

I'm looking for some italian course to start with UTF     Unified Testing Function .

I manage a team of all Italian people and they speak only italian language. 

So, this is my problem.

Could some one help me ?



shambhu pandey
on ‎05-06-2014 06:24 AM

thank youu very much

on ‎09-15-2014 06:38 AM



Can this Insight feature be used to automate the Flex custom objects also?

Sharath Chandra Dumpala
on ‎04-01-2015 04:09 AM



I am trying to Automate Tableau Dashboard Reports.


Will this Insight help me?


Please let me know, as most of the objects are recognized as images when QTP 11 is used.


Thank you


on ‎05-15-2015 10:29 AM

Can it work with OCR and how reliably if so?  Thanks.

27 Feb - 2 March 2017
Barcelona | Fira Gran Via
Mobile World Congress 2017
Hewlett Packard Enterprise at Mobile World Congress 2017, Barcelona | Fira Gran Via Location: Hall 3, Booth 3E11
Read more
Each Month in 2017
Software Expert Days - 2017
Join us online to talk directly with our Software experts during online Expert Days. Find information here about past, current, and upcoming Expert Da...
Read more
View all