Learn UFT or UFT Step By Step
Learn UFT or UFT Step By Step
Learn UFT or UFT Step By Step

Table of Contents

Learn UFT Step By Step:

The topics we must cover while learning UFT are as follows:

  • Why do we need to use UFT?
  • Features of UFT
  • Assets of UFT with extensions.
  • How to work with UFT?
  • How to plan a Test?
  • How to understand UAT?
  • Configure and types of Licenses.
  • Install and Configure Add-Ins
  • How to create your test in UFT?
  • Recording modes of UFT.
  • Object Repository concept
  • Functions and Sub procedures in UFT
  • How to use the comment in UFT?
  • Object identification process
  • Step Generator
  • Datatypes in UFT
  • Variables in UFT
  • Looping and conditions in UFT
  • How to enhance Test?
  • Things to know of VBScript
  • Function Library concept in UFT
  • Synchronization concept in UFT
  • Actions in UFT
  • How to Parameterize your test?
  • How to work with Utility object?
  • How to work with checkpoint?
  • How to work with output values?
  • How to work with reporter Object?
  • How to write a custom HTML file?
  • Test Batch Runner
  • What is automation framework?
  • Introduction to Dictionary Object
  • Introduction to File System Object.
  • Difference between Action and Function
  • How to debug UFT script in VBscript debugger?
  • Errors and error handling of VBScript
  • The regular expression in UFT
  • Transactions in UFT
  • How to capture ajax events in UFT?
  • How to use Optional step in UFT?

Why UFT not Selenium?

UFT is a closed source software from HP. Many engineering brains are working the product better. Hence we need a license to use it. However, selenium is open source and there are not much engineers active supporting this. That does not mean it is bad.

While there lot of official help on same topics available directly from HP, Selenium lacks on that space. Testers need to try and find out the best solution.

UFT uses old VBscript hence ramping up from manual testing to UFT is easy but selenium needs knowledge on java, Perl or .NET to write effective code.

The easy recording is available for UFT whereas Selenium does not have an easy recording. We need to code from scratch.

UFT supports almost all known technologies whereas selenium supports web technology.

Lastly, UFT is very much user-friendly, selenium lacks in this space.

First Step to UFT

The first thing you need to learn is VBScript…the basics..The best place to learn VB script is —MSDN

Technology Supported by UFT:


Licenses of UFT:

UFT provides three types of licenses:

  1. Trial with limited facilities
  2. Seat License- tagged to the machine
  3. Concurrent License- depends on the number of users

What is a VBScript to an Automation Test Engineer?

VBScript (Visual Basic Script)

1. It is a scripting language scaled-down version of Visual Basic
2. It runs on client-side.
3. Basically a syntax-based language. Most VB syntaxes run on this.
4. For our purpose, we always save the file as “XYZ.vbs”

How to Work with UFT?

How to work with QTP is a systematic process. Lets us go through one by one…

Analyzing the application

In this phase, we check what kind of application on which tests need to be performed. If required we need to add the add-ins or we need to buy the add-ins.

Selecting Areas/Test Cases for Automation

After the successful pass of step-a, we will identify the manual test cases or the scenarios that we can automate. We can not automate 100% of the application in general.

Planning (Effort estimation, Schedule, Work allocation and Automation Framework implementation)

We will do an effort estimation for Step-b. We will also consider the schedule, framework effort in this phase.QTP records raw lines of codes. So transferring those from code to framework or add to existing framework is an effort. In the last phase, we will identify the team members and allocate them the work.

Creating Generic and project-specific functions

While recording we might get some generic function like button press..it is common to all the window/pages…this can a be a good trick to write a small function on button press and can reuse them. Or we might get a new flow which is very specific to a business.

Creating required Automation resources (Functions, Object repository Files, Environment variable files—etc)

This is as per the organization test strategy. If test strategy says we need to do record playback then it is ok to record and store objects in object repository or else we will go descriptive programming.

UFT Function and Sub Procedure

UFT allows all to run the same and repetitive tasks in the form of functions which can return some value and sub procedure which does not return any value.

Object Repository in UFT:

Object Repository is a place where UFT stores all its objects it learns during recording phase. Object repository can be build manually as well. Read more on Object Repository here.

What is Descriptive Programming in UFT?

Entering / Providing objects information directly into the test script is called Descriptive Programming. When QTP/UFT records any action on any object, it tries to identify the object with some of its properties. And stores them in an object repository. Later point of time, during execution, it takes reference from it and tries to find out the object in the application and perform a set of operations.

So, if an object is not present in the object repository, QTP/UFT can not identify the object and operate on it.
With the fast development of application and agile way of developing software advocates more about descriptive programming. Imagine we need to design our test script without the GUI. Yes!! it is possible.

Learn more about Descriptive programming.

Be careful when using dual monitor to open Object Repository

This is very interesting challenge while using UFT/QTP in dual monitors. The object repository is notorious to open in the second monitor and behind the active window.(Even if you are working on the primary monitor- Screen-1). Sometimes it is not visible too. This can also happen for laptop and second monitor, computer/laptop with a projector.
Solution: As per this website we need to use a keyboard shortcut to make it active in Screen-1(primary screen). The keyboard shortcut is ALT+spacebar then press M and press up/down/left/right key to make object repository appear in the primary monitor.

How to Use Repository Collection Object in UFT/QTP?

Repository collection object enables us to work with the shared object repository during execution or run time. This is another way to handle object repository but via code.

Repository collection provides us the below methods:

  1. Add()
  2. Find()
  3. MoveToPos()
  4. Remove()
  5. RemoveAll()

Repository collection provides us the below properties:

  1. Item
  2. Count
Details of Add() method

Add() method adds a shared object repository to the specified index during execution with the currently executing action. This method does not return anything.



Here ObjectRepositoryPath is a mandatory parameter and position is an optional parameter.


Dim my_repo_path
Details of Find() method

Find() method returns the position of the specified object repository during execution or run time for the currently executing Action. This method returns a number specifying the position of the object repository.



Here ObjectRepositoryPath is a mandatory parameter.


Dim my_repo_path,pos
msgbox pos
Details of MoveToPos() method

MoveToPos() method can change the object repository position from the current index to a new user-specified index. This method does not return anything.



Here ObjectRepositoryPath,currentpos, and newpos are mandatory parameters.


Dim my_repo_path,currentpos,newpos
Details of Remove() method

Remove() method removes a particular object repository based on the index from the current Action. This method does not return anything.



Dim my_repo_path,index
Details of RemoveAll() method

RemoveAll() method removes all object repositories available from currently executing Action. This method also does not return anything.




Details of Properties

Details of Count property

The Count property retrieves the number of object repositories from the currently executing Action. This property returns an integer that signifies the number of object repositories in the current action.

Syntax and Example:

Dim repo_count
msgbox repo_count
Details of Item property

Item property retrieves the path information based on the index from the currently executing action.The output is the string representation of the path information of the object repository.



Dim repo_path,Index
msgbox repo_path

Can you update object repository parameter at runtime?

We can get or set the values of repository parameters using repository object. Remember any change we will make using repository object is temporary and valid for current execution. They will stand void once the test finishes execution.

Setter method for object repository
Getter method for object repository
RepositoriesCollection.Add repositoryPath,position

repositoryPath can be an absolute path or relative path. If you do not wish to provide any position, the object repository will be added to the last of object repository collection.(index=-1).

UFT Object Identification process to Store in Object repository

Object Spy

Object spy is a tool provided by UFT or QTP to investigate an object. We can also see methods and properties.

How to open Object spy?

Navigate Tool–> Object spy to open and launch object spy.(A black color coat guy poses as spy or detective.). Once object spy is launched you can see a hand symbol or pointer appears on the screen.You can click control key of the keyboard to toggle to normal window.

Once you have determine the object to investigate, release control button and activate object spy and click on the object.The object spy will show the object hierarchy. You can check Test Object(TO) properties and methods along with Runtime Objects(RO). The selection is done by clicking on the radio.

The object spy pane has the following components

  1. Spy again.
  2. Highlight object to the application.
  3. Add object to the repository.
  4. Copy object property to clipboard.

The next pane shows the object Hierarchy after a successful spy.

The last section is the object properties and operations. If you select any object from the object hierarchy pane,you will get the properties and operation of the object.

Properties can be native or identification. Operations can be native or test object.Object spy is also available from the object repository window.

UFT Mandatory Property

Logical name

Logical name is an unique identifier provided by UFT/QTP to identify the component uniquely from other objects in the application. This name is used by UFT/QTP to map between object and its properties.

You can not remove association between an action and its local repository. But you can edit the logical name if you want to make it clear for you and your team.

UFT Ordinal Identifier:

If there are more than one objects with same class name,properties,UFT/QTP will not be able to identify uniquely with mandatory or assistive properties. In that case UFT/QTP activates ordinal identifiers. Ordinal identifiers are kind of numerical values that are assigned to objects to identify the object uniquely.

The ordinal identifiers can be

  1. Index
  2. Location
  3. CreationTime

Index is assigned from top to bottom or below.


If location property is taken by UFT, the index is assigned left to right and top to bottom.


CreationTime holds good for web application. If we open two or more web  browsers (mainly in Internet Explorer), UFT/QTP will not be able to identify the web browsers uniquely. In that case it determines by CreationTime. The first opened browser is identified by CreationTime:=0 and the second one will be CreationTime:=1 and so on.

In order to work with the browser we need to code like:


Where index starts from 0 to no of open browser count-1.

Visual Identifier

The relative position of an object gives more reliable object identification.

How to use property which is dynamically changing?

If the value of a particular property for an object changes,you can activate regular expression(click on the checkbox). You can provide ‘.’,’*’,'[]’ ect to define an object property.

Alternatively you can select datatable or environment or random number. We need to activate radio button ‘parameter’ and create necessary settings.

Automatic Object Model and Object Repository

In UFT/QTP , Automatic object model enables you to manipulate UFT/QTP shared object repositories and their contents from outside of the UFT/QTP.

The Automatic object model enables you to use a scripting language to access UFT/QTP shared object repositories via automation.

UFT/QTP object model can be used to automate UFT/QTP operations. You can use the objects and methods of the object repository automation. Automation object model helps to write programs that manipulate shared object repository, instead of performing these operation manually using object repository manager.

After you have received the object,you can manipulate it using the methods and properties available for the test object class. You can use GetToProperty or SetToPorperty method to fetch and modify object’s property.

ObjectRepositoryUtil Object the fuel of Automatic Object Model

ObjectRepositoryUtil object helps us to work on or manipulate shared or local object repositories from outside of the UFT/QTP via automatic Object Model.

ObjectRepositoryUtil object provides the below methods

  • AddObject()
  • Convert()
  • CopyObject()
  • ExportToXML()
  • GetAllObjects()
  • GetAllObjectsBy()
  • GetChildren()
  • GetChildrenByClass()
  • GetLogicalName()
  • GetObjectByParent()
  • ImportFromXML()
  • Load()
  • RemoveObject()
  • RenameObject()
  • UpdateObject()
  • ToCollectionObject()
  • Save()

Details of the methods:


AddObject() method adds a specified object to the local or shared object repository under the specified parent object. AddObject() method further helps to add an object that is being copied from another repository. AddObject() method also supports modifying object properties (description) by using SetToProperty before adding the new object to the repository.



newObject is the new object that needs to be added to the repository. It is a mandatory argument.Parent is the object under which the new object will be placed. It is also a mandatory argument. Name is an optional argument.


Convert() method converts older like QTP 8.2 or former object repository to the current working format. We can directly use convert() method to convert older object repository to newer version without using Load() method.



CopyObject() method creates a copy of the specified object in the same repository. It just duplicates an object during runtime. To copy from one object repository to another object repository , we need to copy object then load the second object repository and then call the AddObject() method.



ExportToXML() method exports the specified object repository to the XML format.


  • Plain test objects without the checkpoints or output values are exported to XML.
  • Local object repository can not be exported to XML. Only shared object repository can be exported.
  • The latest version of UFT (version 9.0 onwards) supports the export to XML.
  • Older repositories need to be converted first using Convert() function to the latest in order to export to XML.



GetAllObjects() method returns all objects from a specified parent object from a specified object repository. GetAllObjects() methods returns a collection of objects. We need to use a For Each…Next loop to loop through each object from the collection to get all object related information.



GetAllObjectsBy() method accepts a specific class, provides another filter option available to get all objects of that specified class for the specified parent object. GetAllObjectsBy() method returns a collection of object information about the objects.We need to use For Each… Loop through each object from the collection to get the specific objects related information.



GetChildren() method returns all direct children of the specified parent. GetChildren() returns a collection of object information about the children objects. We need to use For Each… Next loop to loop through each children object from the collection to get the specific objects related information.



GetChildrenByClass() method returns a collection of children objects from a parent object of a specified class.As this method returns a collection of object information about the children objects. We need to use For Each… Next loop to loop through each children object from the collection to get the specific children objects related information.

coll=Object.GetChildrenByClass(Class parent)

GetLogicalName() method returns a string representing the logical name of the object.


GetObject() method returns the objects available from an object repository based on the path. This is useful when we do not have access to the parent object of the target object.As this method returns a collection of object information about the children objects. We need to use For Each… Next loop to loop through each children object from the collection to get the specific objects related information.


GetObjectByParent() method is useful when you have access to the parent object. It returns a collection of objects based on the parent information.As this method returns a collection of object information about the children objects. We need to use For Each… Next loop to loop through each children object from the collection to get the specific objects related information.


ImportFromXML() method imports the specified XML file to share object repository. This method can not be applied to import local object repository.The XML will have only test objects and its descriptions. No checkpoint information or output values can be imported by this method.


Load() method loads an object repository to the current test action. We can load multiple object repositories by creating required number of RepositoryUtil objects.

Object.Load(ObjectRepositoryFilepath along with name)

RemoveObject() method removes a specified object from object repository.


RenameObject() method renames a specified object located in the object repository.


Save() method saves all changes made to the object repository during execution.


UpdateObject() method updates the object repository if any changes has been made during script execution.


Introduction to File System Object(FSO)

FSO provides us the ability to work with files and folders. FSO will also covers on how to work with folders.

Data Types in UFT

UFT supports VBScript Data types.

Variables in UFT

UFT supports VBScript variable concept.

Creating Tests (Using Object Repository or Descriptive Programming)

Automation process Using UFT

The automation process is the basic building block of UFT test cases. The Automation testing via UFt consists of the following processes:

  1. Prepare for recording.
  2. Actual recording
  3. Enhancing test script.
  4. Debugging
  5. Analyze the result
  6. Reporting

Recording in UFT

The recording is the fundamental process of building the test script.

Preparing for recording:

Before we start hitting the recording button, we need to make sure the application is stable and the object is constantly visible for recording to happen.

Before you start recording it is always better to close all other applications or web pages.

In Record and Run settings, we can define if we want some default application to open during recording similarly for web, in web tab we can define if some predefined webpage we want to open.

After the recording, you can use the stop recording button to stop recording.

Recording in UFT

As and when, we navigate through the application or web pages using UFT recording, UFT will mimic the same steps in keyword view and expert view. In the keyword view, the steps will come as rows and columns and in expert view, it will come as plain code.UFT supports 3 recording mode to combat different scenarios.

Different Recording modes of UFT:

Recording a test is to keep a track of the user’s behaviors and actions on the application. Recording helps UFT to translate these actions into the test script. The recording also acts as a quick check if the application under test is supported by the tool for carry out testing.

UFT/QTP supports record and playback options. Recording modes of UFT enables us to understand object learning better during the recording phase. Different types of recording modes(Standard recording mode, analog recording mode in uft, Low-level recording mode in uft) enables us to automate the different types of scenarios. It is very important to understand about the recording options available in UFT/QTP.

UFT Recording modes
UFT Recording modes

we have four recording options.

  • Standard recording mode  default recording mode based on object’s properties.
  • Analog recording mode- based on keyboard and mouse operation
  • Low-level recording mode- coordinate based but not based on object properties
  • Insight Recording mode-  based on operations on the UAT and its appearance but does not depends on object properties.

This-how many types of recording modes in uft? is a very popular question in the interview as well

Standard Recording Mode

This is the default mode in UFT/QTP which can record all operations. UFT/QTP’s normal recording mode records the objects in our application and the operations performed on them.

This mode is the default and takes full advantage of UFT/QTP’s test object model, recognizing the objects in our application regardless of their location on the screen.

Navigation for standard recording:

Select Record option on automation toolbar
Use shortcut key (F3)

During recording UFT generates VbScript statements in Test Pane, Simultaneously it stores objects information into object repository.

Steps for Normal recording:

We need to perform the following steps for preparing a Test (through Recording):

  • Put AUT in base state
  • Select Record Option
  • It shows Record and Run Settings, Select type of Environment (Windows or Web)
  •  Select Record Option (It shows two Options)
    Record and Run Test on any open window-based applications
    Record and Run only on If we select the first option it records on any opened application on Desktop. If we select the Second option, it asks for the path of the AUT, After Providing the path it records only on that particular application.)
  • Click OK
  • Perform actions on AUT
  • Stop recording.
  •  Save the Test

While answering different types of recording modes in uft , just remember, low level and analog recordings are not very popular among the test gurus so they don’t like it much. Focus on the normal mode. It is very important.

Here is the way to record in normal mode:

  • Click the Record button or choose Automation > Record. If we are recording for the first time in a test and have not yet set our recording preferences (by opening the dialog box manually), the Record and Run Settings dialog box opens. It is divided by environment into several tabbed pages.
  • To choose an environment, click a tab.

  • Set the required options, as described in the following sections.
  • To apply our changes and keep the Record and Run Settings dialog box open, click Apply.
  • When we have finished the operation, click OK to save our changes and start recording. Guidelines for Modifying Record and Run Settings After we set the record and run settings for a test, the Record and Run settings dialogbox will not open the next time we record operations in that test. If needed, we open the Record and Run Settings dialog box by choosing Automation > Record and Run Settings.

We should set or modify our record and run preferences in the following scenarios:

  • We have already recorded one or more steps in the test and we want to modify the settings before we continue recording.
  • We want to run the test on a different application or browser than the one we previously set in the Record and Run Settings dialog box.

If we change the record and run settings for additional recording sessions, we need to confirm that we return the settings to match the needs of the first step in our test before we run it.

How to record the web ?

Record and run test on any open browser Instruct UFT/QTP to record on any open Microsoft Internet Explorer browser and run on any open supported Web browser (refer to the UFT/QTP Professional Readme for information on supported browsers).

Note: We must open the Web browser after we open UFT/QTP and select this option.

Tip: we can instruct UFT/QTP to ignore selected browsers that are open during the record and run session. Open the following address when a record or run session begins Instructs UFT/QTP to open a new browser session to record and run the test using the specified URL address.

When recording a test, the address is opened in a Microsoft Internet Explorer browser. When running a test, the address is opened in the browser type specified in the Open the following browser when a run session begins box.

Note: If we define a value for the URL_ENV environment variable, that value overrides the value specified here during a run session. Open the following browser when a run session begins Instructs UFT/QTP to open the specified browser type when running a test:

  • Microsoft Internet Explorer
  • Netscape 8.x
  • Firefox 1.5

Notes: Only those browsers currently installed on our computer are available in the list. If we define a value for the BROWSER_ENV environment variable, that value overrides the value specified here during a run session. Do not record and run on browsers that are already open Instructs UFT/QTP not to record or run tests on any browsers that are already open prior to the start of the record or run session (and prior to opening UFT/QTP).

Selecting this option also prevents us from viewing the properties of these browsers using the Object Spy. Close the browser when the test closes Instructs UFT/QTP to close the browser window specified in the Address box when the test closes.

How to record Window-based Applications?

Option Description Record and run test on any open Windows-based application Instruct UFT/QTP to record and run on any open Windows-based application.

Note: We need to make sure that all the applications on which we want to record are currently closed. UFT/QTP can record on the applications that we open manually only after we select this option and click OK.

Instances of these applications that are already open when the Record and Run Settings dialog box opens may be ignored or may not be recorded correctly. Record and run only on Instructs UFT/QTP to restrict its record and run operations to one or more of the following options:

Applications opened by UFT/QTP:

This option records and runs only on applications invoked by UFT/QTP (as child processes of UFT/QTP). For example, applications opened during a record or run session using a SystemUtil.Run statement, or using a statement such as

Set shell = createobject("wscript.shell"); 
shell.run "notepad".

Applications opened via the Desktop (by the Windows shell):

This option records and runs only on applications that are opened via the Windows Desktop. For example, applications opened from the Windows Start menu, by double-clicking executable files in the Windows Explorer, by double-clicking a short cut on the Windows Desktop, or by clicking icons on the Quick Launch bar.

Applications specified below:

This option records and runs only on applications listed in the Application details area. This is the recommended option to use. When working with standard Windows applications only, we can manually add steps to our test and then run them, even if we select this option and leave the Application details area blank (or if the list does not contain the application for which we want to add a step).

Note: Make sure that all the applications listed in the Application details area are currently closed. UFT/QTP can record only on the instances of the specified applications that are opened after we select this option and click OK.

Instances of these applications that are already open when the Record and Run Settings dialog box opens may be ignored or may not be recorded correctly. Application details List the details of the applications on which to record and run the test. For more information on the details displayed.

If we define values for one or more environment variables, those values override the values in the Windows Applications tab during a test run. By these above methods, we can get the script but in the object repository, we might get extra unnecessary objects. So to avoid this a little advanced approach will be to add those required objects to OR[Object repository] and then perform normal recording. Shortcut Ctrl+R or by navigating to Resources to the Object repository.


It records User Mouse and Keyboard operations on AUT with respect to objects, but unable to record continuous mouse operations like Digital Signatures, graphs, paints, etc. When working with specific types of objects or operations, however, we may want to choose from the following, alternative recording modes:

Analog Recording Mode:

This is the second Recording modes of UFT. Here UFT can identify the object but can not record. For example, UFT can identify the paint/drawing bar normal mode but can not draw the picture or can not draw a signature by normal mode. To solve such a problem we will choose the analog recording mode.

UFT will identify the object and the analog operation over it. It will record the keyboard and mouse movement on the recognized window. Similarly, when testing signature we use Analog Recording Mode. Analog Recording enables us to record the exact mouse and keyboard operations we perform in relation to either the screen or the application window.

In this recording mode, UFT/QTP records and tracks every movement of the mouse as we drag the mouse around a screen or window. We can use this mode for recording continuous mouse operations. however it does not generate steps for each operation, generates total user actions in a Track File. The Track file is not editable.

There are two modes of recording:

  1. Relative to a specific window
  2. Relative to screen

while answering different types of recording modes in uft, we may touch this portion, Relative to a specific window is more important over Relative to screen

Relative to the window:

Activate this option if and only if operations performed on UAT located within one window. During analog recording mode in uft, UFT tries to identify the window location and can perform operations(record the analog step) even if it is located in a different locations. Interestingly UFT does not record any keyboard operation or mouse movement outside this window. Active Screen image of the final state of the window is captured.

Relative to Screen:

This is a very rare scenario where we need to perform some analog recordings with respect to the screen. This is applicable during run time that is execution time also. It can also be possible if the AUT is having multiple windows opened. No active screenshot is taken/captured during this type of recording

Best to use while Automating:

1. Paint operation
2. Drag and drop


1. Keep tool under recording mode
2. Automation >Analog Recording OR Use Short cut Key (Shift + ALT+F3)

Steps for preparing a TEST (through Analog Recording):

In order to perform the analog recording, we have to do the followings

  • Launch AUT (or we can launch AUT through UFT)
  • Select Record option
  •  Automation>Analog Recording
  •  Analog Recording Settings Dialog box opens (In this Dialog box two options available.

The record relative to the screen
The record is relative to the following window If we select first option UFT records User operations with respect to Desktop co-ordinates. If we select the second option, we have to show the window (AUT), after showing the Window it records with respect to that window co-ordinates.)

  • Select any one option in the dialog box and click Start Analog record.
  • It records User actions
  •  Stop Recording This mode is useful for recording operations that cannot be recorded at the level of an object, for example, recording a signature produced by dragging the mouse. Note: we cannot edit Analog Recording steps from within UFT/QTP. To execute this UFT invokes RunAnalog command like-
Desktop.RunAnalog "Track1"
' This is for Relative to the scren but for relative to a window the code will be--
Window({name of the window}).RunAnalog "Track2"

Both this two recoding mode eats up huge disk space. So please do not use these if not required. Mixing of the normal analog mode of recording is possible and we can switch to these modes if required. In general, avoid analog recording mode in uft.

Low-Level recording:

This is the third Recording modes of UFT. UFT can not identify the object under test. Hence it can not proceed with recording. As UFT can not identify or recognize the application under test, Analog Recording Mode can not be operated. So if we need to test such an application, we need to activate Low-Level recording.

By enabling this mode of recording, UFT will identify objects and by default class window or win Object and will record all keyboard and mouse operation. Low-Level recording enables we to record on any object in our application, whether or not UFT/QTP recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or WinObject test objects.

Use Low Level Recording for recording in an environment or on an object not recognized by UFT/QTP. we can also use Low-Level Recording if the exact coordinates of the object are important for our test. In this level of recording, UFT identifies coordinates mostly to record and run.

While different types of recording modes in uft, we should touch this point but keep it short and be honest if we have not used this feature.

Note: Steps recorded using Low-Level Recording mode may not run correctly on all objects. It records some operations on Non-supported environments apart from Normal operations. This mode records at the object level and records all run-time objects as a window or winobject Test objects. Use Low-Level Recording for recording in an environment not recognized by UFT.

Mouse movements are not captured during low-level recording.


To record in the low level we have to perform the following steps:

  • Keep tool under recording mode
  • Automation > Low-Level Recording

Steps for preparing a TEST (through Low-Level Recording):

  • Launch AUT (or we can launch AUT through UFT)
  • Select Record option
  • Automation> Low-Level Recording
  • Perform options on AUT
  • Stop Recording
  • Save the Test So similarly between analog and low-level recording, in both cases, UFT uses keyboard, mouse and work on co-ordinates. But the difference is in Analog mode UFT can identify the object in UAT but in Low-level recording, it can not.

One more important aspect of the low-level recording is it majorly depends on the co-ordinates. So in normal mode if the coordinates change for an object,still UFT will identify the object and performs operations.

But in such a case where coordinates like the location of the object is very important, we can use the low-level recording to check the location of the object. Mostly It supports Click,DbClick,Drag,Drop,Type,Activate,Minimize,Restore etc.

different types of recording modes in uft also bring the step details into the table. just follow this guideline once. we will mostly not forget.

Steps to follow before we start recording:

1. Before we record a test, confirm that our application and Quick Test are compatible with each other.
2. Start QTP Check the required Addin in Add-ins manager. Else add those. Like for java application we need to have JAVA add-in. While UFT/QTP loads our selected add-ins, the UFT/QTP splash screen is displayed. This may take a few seconds. confirm that the Web Add-in is selected, and clear all other add-ins. Click OK to close the Add-in Manager.
3. Make sure the application is ready.i.e.Make sure our application displays elements on which we want to record, such as a toolbar or a special window pane, for example, and that our application options are set as we expect for the purposes of our test.
4. we should also view the settings in the Test Settings dialog box (File > Settings) and the Options dialog box (Tools > Options) to ensure that Quick Test will record and store information correctly.
5. if we are using Internet Explorer as our browser, the AutoComplete option is cleared for user names and passwords.
6. Please close all the other browsers.
7. If the Welcome window opens, click Blank Test. Otherwise, choose File > New, or click the New button.

Is it possible to switch between recording modes during test creation?

Yes, It is absolutely legal to switch between recording modes during test creation. However, switching to Analog mode is only possible during recording but not during editing.

Remember Analog and Low-level recording mode are very expensive in terms of system resource like- memory. Hence we need to use them occasionally.

last but not the least, different types of recording modes in UFTtopic also put us in a situation where test guru may want to know how will tackle dynamic events?

Remember this recording mode does not help to capture the dynamic behavior of the website. Read here to get details on how to capture the dynamic behavior of a page.

Insight Recording in UFT

As I said earlier, Insight recording ios based on the appearance of the object. Here are the two best articles already present.

If you enjoyed this post, please share it on social media ?”What am I missing here? Let me know in the comments and I’ll add it in!”

Understand the recording

Once you have completed the recording in UFT the keyword view will be like below:

Item Operation Value Documentation
Action1 Name of the action
ParentWindow The main window which UFT will refer for further recording
Child Object Set/SetSecure/Click etc somevalue based on the object the operations are defined in this format.
The value is the value that the object will take during recording.

Enhancing Tests

(Inserting Checkpoints, Output Values, Transaction points, Flow Control Statements, Synchronization, Parameterization—etc )In this phase, we need to create some validation points.

Enhance test script:

In this phase, we will insert checkpoints, attach the tests with different data, update the script with environment variables. We will also make the recorded script dynamic by using the conditions and loops.

Get Values or SetValues and checkpoints:

I not a big fan of Checkpoints available in UFT or QTP as they are unreliable at times. But inserting checkpoints we can search for specific values from the page, object or text String. Checkpoints determine if the application is working properly.

How to work with output values?

Output values in UFT allow us to test the values of an object or allow us to pipe the output of one script or component to others.

It is a step in which one or more values are captured during test execution and are stored in output values. The values can be retrieved later and can be used as input at a different point in the run session or we can use as input for another test.It is stored in run time data table; it is located in QTP/UFT result window.

The values of properties of any object can be exported via output values.Output values techniques also allow us to fetch data from the below written sources:

  • Text strings
  • XML document
  • Databases
  • Table cells

Note: Output values are valid only during run session. Once the execution is over, the values get resetted.

It is always good to learn Checkpoint in UFT in order to understand the Output values better.

Where the output values get saved?

The output values can be saved the following areas:

  • Action or Component(if BPT is used).
  • The runtime datatable.
  • An environment variable.

We can define the output values and it location while configuring the output values.

How to pass parameter to action or component?

we will be able to pass parameters to an action or component parameter. This is helpful to supply values later during the run session. The values can also be passed to external application during script execution which will call the test or component.

It is mainly dependent on two parameters:

  • Type- Shows the type of parameter like- String
  • Description- Shows the description defined for the parameter.

How to pass output data/ parameters to Data table?

We will be able to pass the data and store the output values in datatable. In the datatable we can store inside the followings:

  • Global sheet
  • Action sheet
  • All different actions in the current test.

The following options are important while we place output values to data table:

  • Name- The column name in which the value will be saved.
  • Location- In which sheet the data will be stored?(like -global or action sheet)

How to pass output values to an environment variable?

We will be able to store the output values to an Environment variable. We can select the Environment as the output type in the output options dialog box(dropdown). The Environment variable will be off user-defined Environment variable. In that Environment variable we can store the output value.

The two important aspect of Environment variables are :

  • Name- Name of the user defined environment variable in which we will store the output value.
  • Type- It is read only and cannot be edited or altered. The value will be User defined-Internal.

The out of the box UFT addins and their support for output values

Output Value Web Windows VB ActiveX
Standard Y Y Y Y
Page(Standard) Y NA NA NA
Table(Standard) Y NA NA Y
Text Y(Page frame and view link) Y Y Y
TextArea NA Y Y Y
Database Y Y Y Y
XML from Application Y NA NA NA
XML from resource Y Y Y Y

Y stands for supported and NA stands for not applicable/not supported

Types of Output Values:

  1. Standard output value
  2. Text output value
  3. Text area output value
  4. Database output value
  5. XML output value (From Application)
  6. XML output value (From Resource)
Standard output value:

We can use standard output values to output the properties values of most objects. Like- number of links present on a web page.We can also create standard output values to output text string by providing the text property of the object as an output value.

Navigation for Creating Standard output values:
  • Open a new test
  • Keep tool under Recording mode
  • Click on Insert menu >output value> standard output value [at this point UFT will be minimized and a hand symbol will come]
  • show the object > click ok [It will open the Object selection-output value properties window]
  • The output values properties window will open.
  • select property in order to read the property
  • Modify the column name (if required) > click ok [This will open Output options window]
  • Select the output type in list box.
  • Enter the column name where you want to store the value.Like Datatable
  • click ok
  • Stop recording.

The code will look like:

Window("WindowName").WinButton("ButtonName").Output CheckPoint("PropertyName")
Text output value

We can use Text output values to output text strings displayed in an application, web page,screen. When creating a text output value we can output a part of the objects text and we can also specify text before and text after options.

Navigation to create Text output value:

  • Start a new test
  • Keep tool under recording mode
  • Insert menu> output value > text output value[UFT will be minimized and a hand symbol will appear on the screen]
  • Select the object. It will open the Object selection-output value properties window.
  • Click  on ok. It will open the Output values properties window.
  • show the text
  • select one of the option(output text/text before/text after)
  • Click modify if you want to change the column name. It will open Output Options window.
  • select one of the option(output text/text before/text after)
  • Select output type in the list box like datatable or environment variable. Incase we select the datatable we need to provide column name to store the value in the runtime.Similarly if we select the environment variable we need to specify the Environment variable name.
  • > click ok > click ok.> check in runtime table after running it.

The code will look like:

Window("WindowName").WinButton("ButtonName").Output CheckPoint("PropertyName")

Text Area output value:

We can use text area output values to output text strings displayed within a defined area of the screen. Apart from these Text Area output value can fetch text present in the bitmap or strings from an object.

Navigation for inserting TextArea Output values:
  • Open a new Test.
  • Keep tool under recording mode
  • Insert menu >output value > text area output value[UFT will be minimized and a hand symbol will appear on the screen]
  • Mark the text area
  • Select the object. It will open the Object selection-output value properties window.
  • Click on OK. It will open Output Values Properties window.
  • Click modify the column name if necessary. Options window opens.
  • Select Datatable if you want to store data in the datatable. In that case specify the column name and sheet name. If you are selecting environment variable provide the environment variable name
  • > click ok > again click ok > check in run time table after running it.

The code will look like:

Window("WindowName").WinButton("ButtonName").Output CheckPoint("PropertyName")
Database output value:

We can use Database output values to output the value of the contents of database cells. The data is dependent on the query(a result set) to the database. The output value can be created from the entire content of the result set or some parts of it.

Navigation to insert Database output value:
  • Open a new Test
  • Insert menu-> output value-> Database output value
  • choose specify SQL statements manually ->click next ->click create
  • Select Machine Data source -> Select Driver (Or DNS)
  • Enter SQL statement or query
  • Click on Finish
  • Select data cells to fetch data
  • Click on Modify if you need to change
  • Specify the parameters name
  • click ok > Run and it will capture and see the results in run time table.
XML output value (from application):

we can use XML output values to output the values of XML elements (attributes, variables, elements) in XML documents.

Navigation XML output value (from application):
  • Open a new Test
  • Keep tool under recording mode with web environment
  • Insert menu > output value > XML output value from application
  • Show the XML document > select elements > click ok >stop recording.
XML output Value (From Resource):

We can use XML output values to output the values of XML elements (attributes, variables, elements) in XML documents.

Navigation XML output Value (From Resource):
  • Start a new Test
  • Insert menu >output value> XML output value from resource
  • Browse path of the XML file
  • Select the variable attributes
  • Click on Modify to change the column name
  • click ok

This article also provides answer for the following questions:

  • What are the output parameter types in output values?
  • What are the difference between Text output values and Text Area Output values?
  • Where do we store output values?
  • Why we will use Output values?

The very next topic is Variable:

Read here for more details on Variables.

Environment Variable in UFT:

Read about Environment variables here

Loop and conditions in UFT

By loop and conditions, we can upgrade our script and put intelligence.

Datatable related Operations:

How To Work With Datatable In QTP or UFT

This Post Also talks about How To Work With Datatable In UFT. If we are working on QTP/UFT for quite a few time the immediate question comes like how to parametrize my test?

How to check a scenario with multiple sets of data. Unlike other automation tools, QTP/UFT also provides a data-driven or data-oriented concept called data-table to parametrize our tests.

So data book or databank is used to pass the inputs to the script and also to capture output or live data from the script during run time.so basically using of data table is required when we want to run a test multiple time with multiple data.

The basic example could be to test login module. In login we will provide several user id and password and test if it is working fine or not.

Four Commonly Used Methods on ComboBox in QTP/UFT

In an application today Combo box or select box or drop down is an essential part. Here developers provide choices that should be selected by user. Advantages of combobox or select box or dropdown is that it is single linear in view and restricts users to provide multi form of same data.
Very popular example could be country or state drop down. Say in a registration form ,User from India needs to select Country as India.But if this would have been a textbox, user might put Country -India  or INDIA or india. This will go to server as String.From technological point of view these are three different Strings!!!.
So by providing India on dropdown developers restrict user to select a single,defined String called India.

Commonly user methods on Combobox or Dropdown or select in QTP are-

  • Count of Items in Combobox or Dropdown or select
  • Fetch specific item from Combobox or Dropdown or select
  • Complete List of items from combobox or Dropdown or select
  • Select one from Combobox or Dropdown or select

Let us do one by one-
How to get Count of Items from Combobox or Dropdown or select
For getting count of Items from a Combobox or Dropdown or Select we will use getItemCount method.
Syntax-Variable_Name= <Hierarchy of Object >.Combobox(“Combobox_name”).GetItemsCount

dim x
//abc and xyz can be fetched from Object spy
//for descriptive programming
dim x

How to get specific item from Combobox or Dropdown or select
For this case , the command we will be using is GetItem(Position).position starts from 0. It is nothing but Index value.
Syntax-Variable_Name=<Hierarchy of Object >.Combobox(“Combobox_name”).GetItem(2)

dim x
//abc and xyz can be fetched from Object spy
//for descriptive programming
dim x

How to get complete list of Items from Combobox or Dropdown or select
For this we will be using GetContent method
Syntax-Variable_Name=<Hierarchy of Object >Combobox(“Combobox_name”).GetContent

dim x
//abc and xyz can be fetched from Object spy
//for descriptive programming
dim x

How to select specific item from Combobox or Dropdown or select
Select is the command to set a value in the combo box
Variable_Name=<Hierarchy of Object >.Combobox(“Combobox_name”).Select(Value_To_Select)
Variable_Name=<Hierarchy of Object>.Combobox(“Combobox_name”).Select(Index_Value)

dim x
//abc and xyz can be fetched from Object spy
//for descriptive programming
dim x

How To Create Parameterization in QTP or UFT?

When recording a Test step, it is more about static in nature as the data are hardcoded in the script. Parametrization is the very next step while making test dynamic in nature. Now let us understand what is a parameter? A parameter is a variable that is assigned a value from different sources or generators. You can say a variable to store temp data.

Through Passing parameters, we can pass multiple values.We use parameterization in Data Driven Testing. Parameterization is an integral part of advance scripting or frameworks specially the data driven testing.

Parameterization helps running the same script with multiple data set over and over.

Which phase we can provide data to Script

How to get data from different source:

  • Through Loop Statements
  • Dynamic Test Data Submission,user input during execution
  • Through Data Table
  • Fetching Test Data directly from External files (Flat files & Spreadsheets)
  • Fetching Test Data directly from Databases (MS Acess, oracle etc).
  • Getting Test Data from front end objects.
Phases of test where you can give some data

Parametrization Through Loop Statements:

We can use loop statements for passing sequential numbers & Logical Numbers.

For order_no=1 to 10 step 1 ' for one increment step keyword is not mandatory
Window("Flight Reservation").Activate
//activate the Flight reservation window
Window("Flight Reservation").WinButton("Button").Click
//Click on the reservation button
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
//Setting the order check box as true
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set order_no
//Providing looping value
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click

Even we can create several other users like Users_1 to user_n,Order_1 to order_n,Item_1 to Item_n etc. But with this approach, we can not generate  and operate strings.

Through Data Table:
QTP/UFT adds one data table (Spreadsheet) for every test, we can use Data Table for Data Driven Testing.
It has four types of usage

  • Entering test data directly into the data table and use them as per need
  • Importing test data from external Flat files(.txt,.csv)
  • Importing test data from external Spreadsheets(.xls,.xlsx)
  • Importing test data from Databases.(Oracle,MySQL)

Via Datatable:
We will use the datatable syntax for getting values:

variable xyz=datatable("column name", Sheet id)

Let’s see how it works:

Agent = Datatable("Agent",1)
pwd=Datatable ("Password",1)
invokeapplication "E:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure pwd
Window("Flight Reservation").Close

if you are using action based framework , the method can be called but data will come from action datatable.
Dynamic User input:
This is such a type of data that is a bit dynamic but needs manual intervention for making it dynamic. So with the help of the input box, we get data from the user and feed it into the script.

Dim myInputVariable
myInputVariable=InputBox("Please Enter the Name")

For every test by default there would be 2 sheets

just by clicking the different sheets we can acess these tables.

Global :-

Global sheet is neutral for all actions. If we want some data to be available all actions in our test, we will be using Global data.This is a default data table. So if you create your test and create your test data in excel, you can rename the test data excel file as global and paste it in the data table folder, those values will populate.

  •  Mostly we will be using MS-Excel for QTP. There are two methods to invoke one excel file to your test.
    1.1. Save your test to a specific folder.
    1.1.1. Open that folder via window explorer.
    1.1.2. Find Default.xls
    1.1.3 Rename it as Default-old.xls
    1.1.4 Now rename your datasheet as “Default.xls”
    1.1.5 Paste it here.
    1.1.6. Reopen your script viz test.

you can find the excel is populated in the datatable area with exact sheetnames given in that excel.

2. Otherwise you can dynamically add excel file through code.
I would say this is very good method. Every time you invoke a excel file that will load into your primary memory . So it is going to consume the primary memory. It is better to load files whenever required.


If we are using different actions,We can store data in the action’s tab but scope is for current action only.
if your underlying data source is Excel , there might be some formula inbuilt in it. QTP has an ability to learn those formula and value from it.  So based on our scope for testing we might pass different datasource.

Datatables are of 2 types in Quick Test

  • Design Time Datatable:-The table that is associated with the test before and after the test execution. During execution this got transformed to runtime data
  • RunTime Datatable:- The table that is associated with the test during the test execution and will be present in the “Results” after test execution.A live dataset.

by default datatable will be stored by QTP under testname–>Datatable folder. If we want to use some other source , we need to code it accordingly.Where it is applicable?
say I am testing two different versions of the same application like-Webversion and Windows version. So the application data might be same but we need to use it from two different location.
Again say I am testing localization testing  of an application, So based on the location I need to pick some other datatable.Such cases this case comes handy.

Supported versions of data souce:

Text files(.txt,.csv)
ASCII format
Even the zip files–
File–>import Test from Zip

Datatable object methods:

AddSheet:-Adds the specified sheet to the run-time Data Table and it returns the sheet so that we can add properties to the sheet in the same statement.




datatable.AddSheet "sheet1"

How to set parameter/properties to it?



datatable.GetSheet("Sheet1").AddParameter "Fly From",""

Next method will be deletesheet
This method will delete a specific sheet from the data table during run time.

datatable.DeleteSheet sheetName



Export :-Saves the copy of the run-time datable in the specified location.

datatable.Export ("location along with Excel name")


datatable.Export "d:animesh.xls"

Note :- if the file is not created /present QTP will create the file at runtime and exports the specified sheet.

ExportSheet :- exports the specific sheet in the run-time datatable to An Excel file .
Syntax :-

DataTable.ExportSheet "location along filename", "sourcesheet"

Three things to know:
1. if the file is not present or created QTP will create the file at runtime and exports the specified sheet.
2. If the excel file is already created but there is no sheet associated with it. QTP will open this file and add the sheet.
3. Say if the file is already created and the sheet is already there, QTP will overwrite the sheets.


DataTable.ExportSheet "C:\techtravel.xls","flight"

if we have a created a sheet called “flight”

DataTable.ExportSheet "C:\techtravel.xls",1

if we want to export the first sheet

Import :- imports the specified Excel file to the run time Data Table




Import method deletes/replaces all table available in datatable during run with its sheets.Remember sheet1 will be copied to Global,Sheet2 will be copied to Action. If you have more sheets in the source excel there will no Excel tab in QTP.So we need to create those tab by addSheet then only we will be able to get those extra sheets else those data is not accessable using this method.

It is a best practice to know the numbers of sheets present in the source file and try to add those sheets during runtime. Then try to get those sheets in QTP.

Import Sheet :- To import the specific sheet in the run time data table.The data in the imported sheet replaces the data in the destination sheet

DataTable.ImportSheet ("location+filename", "Source sheet",destination sheet) 

Example :-

DataTable.ImportSheet "c:\techtravel.xls","flight","Global"

here also you need to create a sheet using datatable.addsheet,then only we will be able to put the flight to run time data.
GetCurrentRow :- returns the current row in the first sheet in the run-time Data-Table(Global sheet).if you are using BPT framework or business component driven approach

Syntax :

var x = DataTable.getCurrentRow


datatable.Import "c:\test\techtravel.xls"
msgbox datatable.GetCurrentRow

GetSheetCount:-returns the total number of sheets in the run-time Data Table Syntax:-

Var x = datatable.getsheetcount

GetSheet :-returns the specifed sheet from run-time Data Table Syntax:- DataTable.GetSheet(“abc”) GetRowCount :-Returns the total number of rows in the longest column in the first sheet in the run-time sheet in the data table(Global sheet) Syntax:- DataTable.GetSheet(“abc”).getRowCount

datatable.AddSheet "abc"
'this will add the temp sheet during run time
datatable.ImportSheet "c:test\techtravel.xls","flight","abc"
'this will import the specific sheet flight to abc
msgbox datatable.GetSheet("abc").getRowcount
'this will give the row count of abc

SetCurrentRow :-set the specified row as the current(active) row in the run-time Data Table Syntax:-




For the above written cases datatable needs to have atleast 1 row. It will try to set that is having a valid data row SetNextRow:-Set the row after the current(active) row as the new current row in the run-time Data-Table Syntax:-


setPrevRow:-set the row above the current(active) row as the new current(active)row in the run-time Data Table Syntax:-


How to Loop through:

Now we need to read the rows one by one…for this we need to select a particular row first.
the syntax is

'i is the looping variable
datatable.ImportSheet "H:\Automation\Sam.xls",1,"Sam"
s= datatable.GetSheet("Sam").GetRowCount
For i=1 to s

Fetch Value from Datatable:

s= datatable.GetSheet("Sam").GetRowCount
For i=1 to 5
msgbox datatable("Name")


Write a code that will capture Fly from and fly To drop down values..save to a user defined sheet and later Export the run time sheet to user defined Drive…

' this will add a new sheet at last
sheetcnt= datatable.GetSheetCount()
' this will give the total number of sheet count 
datatable.GetSheet(sheetcnt).AddParameter "Fly From",""
' this step will get the sheet created at last and add parameter
 datatable.GetSheet(sheetcnt).addParameter "Fly To",""
' this step will get the sheet created at last and add parameter
itemcount1=  Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
'this will give the itemcount from combobox
For i=0 to itemcount1-1
item1=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
' get items one by one
'setting current row
' set value to the datatable
itemcount2=Window("Flight Reservation").WinComboBox("Fly To:").GetItemsCount
For j=0 to itemcount2-1
item2=Window("Flight Reservation").WinComboBox("Fly To:").GetItem(j)
datatable.ExportSheet "C:\Test\techtravel.xls","flight"
'Export datatable to local

Note:Datatable starts with 1 if you are using excel.But Array starts with 0. So we need to be careful while mixing there two.

Code to Read Data From Excel Through QTP or UFT or How to Read Data From Excel Through QTP or UFT?

1st method:

datatable.importsheet "path of the excel file.xls",source sheetID,desination sheetID
n = datatable.getsheet("desination sheetname").getrowcount
for i = 1 to n
columnname = datatable.getsheet("destination sheetname").getparameter(i).name
if colunmname = knowncolumnname then
value = datatable.getsheet(destinationsheetname).getparameter(i)
end if

The more fine tuned way to code…..

2nd method:

set objexcel = createobject("excel.application")
Set objWorkbook = objExcel.WorkBooks.Open("path of the file.xls")
Set objDriverSheet = objWorkbook.Worksheets("name of the sheet")
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
for i = 1 to colunmcount
columnname = objDriversheet.cells(i,1)
if columnname = knowncolumnname then
for j = 1 to rowcount
fieldvalue = objdriversheet.cells(j,i)
end if

How to Compare two Sheets?

'The CompareSheets method compares between two sheets.
'if there is a difference between the two sheets then the value in the second sheet
'will be changed to red and contain the string:
'"Compare conflict - Value was 'Value2', Expected value is 'value2'"
'sheet1, sheet2 - the excel sheets to be compared
'startColumn - the column to start comparing in the two sheets
'numberOfColumns - the number of columns to be compared
'startRow - the row to start comparing in the two sheets
'numberOfRows - the number of rows to be compared
Function CompareSheets(sheet1, sheet2, startColumn, numberOfColumns, startRow, numberOfRows, trimed) 'As Boolean
Dim returnVal 'As Boolean
returnVal = True
'In case that one of the sheets doesn't exists, don't continue the process
If sheet1 Is Nothing Or sheet2 Is Nothing Then
CompareSheets = False
Exit Function
End If
'loop through the table and fill values into the two worksheets
For r = startRow to (startRow + (numberOfRows - 1))
For c = startColumn to (startColumn + (numberOfColumns - 1))
Value1 = sheet1.Cells(r, c)
Value2 = sheet2.Cells(r, c)
'if 'trimed' equels True then used would like to ignore blank spaces
If trimed Then
Value1 = Trim(Value1)
Value2 = Trim(Value2)
End If
'in case that the values of a cell are not equel in the two worksheets
'create an indicator that the values are not equel and set return value
'to False
If Value1 <> Value2 Then
Dim cell 'As Excel.Range
sheet2.Cells(r, c) = "Compare conflict - Value was '" & Value2 & "', Expected value is '" & Value1 & "'."
Set cell = sheet2.Cells(r, c)
cell.Font.Color = vbRed
returnVal = False
End If
CompareSheets = returnVal
End Function

Create an excel sheet and enter a value into first cell through QTP/UFT?

Dim objexcel
Set objExcel = createobject("Excel.application")
objexcel.Visible = True
objexcel.Cells(1, 1).Value = "Testing"

How To Pass User Input Values to Datatable in QTP

The syntax to get data from user is as follows:


Please refer here for more on input box
All datatable methods

'Will add a sheet during runtime
'Create a variable how many sheets are present during run time
DataTable.GetSheet(user_input).AddParameter "Emp_No", ""
'Adding parameter as employee Number
DataTable.GetSheet(user_input).AddParameter "Emp_Name", ""
'Adding parameter as employee Name
DataTable.GetSheet(user_input).AddParameter "Emp_sal", ""
'Adding parameter as employee salary
For i = 1 to 3
' Setting the currentrow
    DataTable.Value(1,user_input) = inputbox("Please provide Employee Nummber")
'getting Employee number as input and storing that in the first column
    DataTable.Value(2,user_input) = inputbox("Please provide Employee Name")
DataTable.Value(3,user_input) = inputbox("Please provide Employee Salary")


Optionally You can export the sheet to local using the exportsheet method.

Script to Import Data From Database to Datatable in UFT or QTP

Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
rs.open"select*from Stud",con
Do While Not rs.EOF
datatable.Value (1,1)=rs.fields("studno")
Database Connection :Microsoft Access database With QTP

The Expert (Database connection) View enables you to access databases using ADO and ODBC. Below is a sample test that searches for books written by an author in the “Authors” table of the database.

Dim MyDB
Dim MyEng
Set MyEng = CreateObject("DAO.DBEngine.35")
Dim Td
Dim rs
' Specify the database to use.
Set MyDB = MyEng.OpenDatabase("BIBLIO.MDB")
' Read and use the name of the first 10 authors.
Set Td = MyDB.TableDefs("Authors")
Set rs = Td.OpenRecordset
For i = 1 To 10
Browser("Book Club").Page("Search Books").WebEdit("Author Name").Set rs("Author")
Browser("Book Club").Page("Search Books").WebButton("Search").Click

VB script to compare two excel sheets

This is a fantastic code to compare two excel sheets.Basically this can be treated as Lean project.:)

ExcelFilePath1 = InputBox("Please Enter the Path of first Excel File")
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(ExcelFilePath1) = false )Then
msgbox ExcelFilePath1 & " doesn't exist."
End If
ExcelFilePath2 = InputBox("Please Enter the Path of second Excel File")
If (fso.FileExists(ExcelFilePath2) = false )Then
msgbox ExcelFilePath2 & " doesn't exist."
End If
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = false
Set objWorkbook1 = objExcel.Workbooks.Open(ExcelFilePath1)
Set objWorkbook2 = objExcel.Workbooks.Open(ExcelFilePath2)
Set objWorksheet1= objWorkbook1.Worksheets(1)
Set objWorksheet2= objWorkbook2.Worksheets(1)
For Each cell In objWorksheet1.UsedRange
If cell.Value <> objWorksheet2.Range(cell.Address).Value Then
'Highlights in green color if any changes in cells (for the first file)
cell.Interior.ColorIndex = 4
'Highlights the same cell in the Second file
objWorksheet2.range(cell.Address).interior.colorIndex = 4
cell.Interior.ColorIndex = 0
End If
objExcel.displayAlerts = False
set objExcel=nothing
msgbox "It is Done dude"

How To Work With Actions In UFT?

An Action creates a logical division of the flows. So the recorded scripts or the coded scripts can be divided into groups.

Action: A Set of the Statements code block for performing a/a lot of tasks/Tasks. This is done for reusability. However, for a conceptual thing action can be non Reusable as well.
kind of final class in java.

Types of Actions:

  • Non Reusable actions- These types of actions are not reusable, hence they can be used only to a specific test.
  • Reusable actions- These types of actions are reusable hence can be called and reused from different tests.
  • External actions-  Offcourse they are reusable actions by nature but they are saved in a different test. We have two options to use external action.
  1. We can create a noneditable version of the external action. So if we need to modify the script, the original needs to be updated. As there is a single point of truth, I mean there is only one original copy, maintenance is easier.
  2. We can create an editable version by copying it into the local test. But after copy, there will be no connection with the original Action. Maintainance becomes tough if we use this type of Action.

Operations on Actions:

  • Creating Actions(Insert>call to new action>enter name of the action>click ok ..now prepare scripts for those action)
  • Splitting Actions(located default action>Edit menu>action>split action>Enter Action 1 name & action 2 name. Actually we need to create a default action –> create total script–>split the default action into different actions)
  • Renaming Actions(Select the action–>drop down box–> edit menu–>action–>rename action–>modify the name>click ok)
  • Deleting Actions(Select the action–>drop down box–> edit menu–>action–>delete action–>confirm deletion–>click ok)
  • Calling an Action(Insert–>call to existing action–>browse path of the test–>select desired action–>click ok) just we need to remember once called an action we can not edit it.
  • Copying an Action(Insert–>call to copy of action–>browse path of the test–>select desired action–>click ok) After copy we can edit this section as this is reusable.
  • Making an Action Reusable/Non Reusable(Select Non Reusable action >edit >action>action properties>check reusable action checkbox >click ok)

If you are using an action-based framework or trying to add external /reusable action try to use reference or relative path of the action is added.

where can we save the OR files:
1. local drives
2. Can be uploaded to QC


How Action Based Test looks like

Test iteration is controlled using Run tab of test settings(navigation–File–>settings) but action iteration is controlled from action call properties.

There are multiple frameworks available on Actions. Combination of Actions and functions. But we must remember, the less the number of actions are inserted, the execution time will be faster. Actions take their own time to load and execute.

How to Check the properties of an Action?

The navigation to get the properties of an Action is as follows:

  • Right Click on the Script Editor | Select Properties
Action Propertise from Script Editor
Action Properties from Script Editor
  • We need to open the solution explorer right click on the script | Select Properties
Action Propertise from Solution Explorer
Action Properties from Solution Explorer

What are the properties of an Action?

The properties of an Action are as follows:

  • Name of the Action
  • Location of the Action
  • Reusable flag to determine if the action is reusable or nonreusable
  • Input parameters for the Action
  • Output parameters for the Action.

How do I create an action template?

If you want to include one or more statements in every new action in your test, you can create an action template. For example, if you always enter your name as the author of an action, you can add this comment line to your action template. An action template applies only to actions created on your computer.

How to Create an Action template in QTP?

To create an action template, create a text file containing the comments, function calls, and other statements that you want to include in your action template. The text file must be in the structure and format used in the Expert View.

Save the text file as ActionTemplate.mst in your dat folder. All new actions you create contain the script lines from the action template.

Difference between Action and Function:

Action and Functions are two important aspects of UFT or QTP. Here is the difference between them.
This is also a popular UFT or QTP interview question.

General differences:

  • We can use actions within QTP/UFT. Actions are purely built-in features of UFT, whereas we can use functions anywhere(i.e. in any programming language like VBScript ).
  • We can call functions within actions but we can’t call actions within functions.
  • Generally, functions are saved with “.vbs” or “.qfl” extension (if written in an external file)we execute those files or add in the test and call the function. whereas actions will save with “.mts”.
  • Actions – can only accept primitive data types as parameters (strings, integers, etc)  whereas Functions – can accept anything depending on its parameter value and usage.
  • In Action parameters always are passed by value only whereas in Functions, we can have pass by value or pass by reference.
  • Actions, depending on the configuration may or may not be reusable whereas by default the functions are reusable.

5)Resource Usage

Actions – For each action, there’s a folder, three separate VBS files, a local Object Repository, a subfolder containing snapshots, an Excel spreadsheet, and a few seconds of load time. Functions – There’s the code contained in the Function.


Actions – we cannot insert calls to Existing Actions through the QTP API, you can only do it through the interface. Functions – we can attach Function Libraries to Test Scripts through the QTP API
Another API implementation- How to Call Reusable API Script From GUI Script in UFT The popular use is to connect QTP with QC.

7.Return Values

Actions – Return values are difficult to understand and read in the syntax. Mostly UFT/QTP can understand that. Functions – Return values work as they do in other languages as I wrote earlier this depends on parameter value.


  • we enhancing the scripts(Checkpoints, output values)insert in the action the actions allows but in the case of functions it doesn’t allow the enhancing the scripts.
  • In the case of call copy action, it won’t reflect into the child’s action to parent action but functions it will reflect into the child’s action to parent action.
  • Mainly very important use:if at all call the Action the particular object information stored into the object repository but in the case of function whenever we call the function it doesn’t store into the object repository.

I suggest using the function-driven approach rather than action-driven. Actions are tightly integrated with QTP. So the migration of the project will be easy.

How to use comment in UFT?

Comments play an important role in UFT scripting. It gives a clear idea of what we are trying to do with the UFT script.

Comments are an integral part of code development in automation framework. So as the Documentation. Comments enable us to create proper documentation in the script. Adding good comments to your code is only one aspect of writing readable and maintainable code.

Good code is always self-explanatory and self-documenting. A comment generally answers the following questions:

  • Programmer’s intention for writing the code.
  • The actual purpose of the script.
  • With respect to the overall scheme of the script, where does this piece of code stand?

Documentation via comments helps many ways:

  • It helps new developers or reviewer to understand the code easily.
  • It helps the existing developers to understand the purpose of the code, who wrote it, what are the arguments, What are the revision history, what are the prerequisite, etc.
  • Comments can make scripts more understandable, more readable.
  • Comments also make debugging easy.

Good comments are generally paragraph-level comments. Few features of a good comment-

  • No line by line commenting. The code should be clean enough to make the reader understand.
  • A comment should clearly and quickly convey the purpose of the code.
  • A comment should stand for the guideline of the code.

Bad comments are those comments which are redundant. They add more clutter in understanding. As a result, they actually do more harm than good.

We can make some code to run and commented code remains un-executed. If you are using static testing, this feature is your friend.

Hence it is always better to provide comment in our script and this section talks a lot about our code.

Comment syntax is not exactly an operator or a variable but works as an ignore line or lines operator in UFT or QTP or VbScript.

WSH or VBScript engine ignores the comment statements during script execution.

Syntax of a Comment in UFT, QTP, VBScript:

This section displays details on

  • how to add comments in VBScript?
  • how to add comments in UFT?
  • how to add comments in QTP?
Rem Statement

Rem statement (After the Rem keyword, space is required before comment.) can be used to comment a line.

It can be given at the beginning of the line like-

Rem to get values from FlyCombo


It can be given after a valid line. like

Windows("xyz").FlyCombo("abc").getValue() Rem to get values from FlyCombo

how to comment in VBS file?

Apostrophe or single quote is treated as a comment (‘).


Once the WSH gets the single quote, it ignores the line.

Other Usage of Comments

We can create Template of Script, or function or methods or class using proper comments.

'Script Name: MyScript.vbs
'Author: Mr X and techtravelhub.com
'Created on:29-Mar-2017
'Description: This script will do so and so operations
'       Rev-2: Animesh did change so and so variable
'       Rev-1: Mr X and techtravelhub.com created the initial script
'initialization section
'Main body
'procedure section
'teardown section

Comment/Uncomment a block of statements

  • Select the block of statement and use the short cut key Ctrl + M (for comment)
  • Select comment block and use short cut key Ctrl + Shift + M (for uncomment)

Purpose of comments in VBScript or UFT or QTP:

  1. We can use comments for making the script understandable hence comments provide code clarity.
  2. We can use comments for making one or more statements disable from execution.
  3. Indent code along with comments make the code readable later.
  4. Using comment we can use white space effectively.
  5. Organize code into logical blocks distinguished by logical comments.

Note: As the English proverb goes too much of good things is never good. It holds good for comment as well. We need to use the comment in such a manner that it should short, understandable, comprehensive and to the point.

Otherwise, the purpose of using comment goes down. The code will become to many junk statement with less Value-added code.

Synchronization Concept in UFT

UFT provides different strategies to work with synchronizations.

How to work with Capture Events in UFT?

Capturing events is helpful when we are working with different events mainly in ajax is getting fired.

Enable different Events in QTP :

while creating a dynamic (QTP) webpage developer must have given few touches of DHTML effect or scripting(Javascript/vbscript). The effect may be few triggers that will invoke something,may be a page loader,may be a color change,may be click event,double click event etc.
Examples of events could be:

A mouse click
A web page or an image loading
Mousing over a hot spot on the web page
Selecting an input box in an HTML form
Submitting an HTML form
A keystroke
Please refer http://www.w3schools.com/js/js_events.asp this for more event information.
Now to capture the web events more smoothly QTP has given the below option to the user….

Enable the ondblclick event in the Web Event Recording Configuration
To enable special event handling, use the Web Event Recording Configuration utility.
1. Go to Tools -> Web Event Recording Configuration.

How To Capture Events in QTP?

2. Click .
3. Expand the Standard Objects branch.
4. Select the object you want to configure.
How To Capture Events in QTP?
5. Go to Event -> Add -> ondblclick. The event will be added to the list on the right.
6. Select “If Handler” in the Listen column.
7. Select “Enabled” in the Record column.

How To Capture Events in QTP?
8. Click to close the dialogues.
Follow the steps while you are recording one script. Hope this will help you to capture different kinds of events on a webpage.

Test Run

A test run is a method by which UFT mimics the user by providing the keyboard or mouse operations to the application without manual interventions.

UFT supports three run modes. They are as follows:

  1. Normal Run or Run
  2. Maintenance Mode
  3. Update Mode
Normal Run Mode

Normal run mode is the default run mode for UFT. It just verifies the current behaviour of the application with the expected one and finds the differences. The test is passed when actual and expected results are the same but failed if they differ.

Below are the steps we need to perform to run a test:

  1. If UFT is not opened, we need to click on the shortcut or need to go to start->Programs->HP tools->UFT and click on UFT to open the UFT.
  2. We need to open the test that we have just recorded or enhanced.
  3. We need to verify if all the images are saved to the test result. For this, we need to choose Tools->Options and select the Run settings. The Save steps Screen Capture to test results option needs to be set as always.
  4. Start running the test.
Maintenance Mode Run

Maintenance mode run allows our tests to run and using various inbuilt techniques, it suggests the process of updating our steps, object repository etc. For updating any scenario, the UFT opens up several corresponding windows and several screens.

Update Mode Run

Update mode run allows us to update tests or components. We need to run component to update the test object description. We can update the data for an entire component or only the part of it. However, it is dependent on which run and debug mode we choose. Once we finish updating the data, the updated data is used in subsequent runs.

Note: While UFT updates the data or components, it is generally gets saved in local object repository even if the object belongs to the shared object repository. Remember, local object repository is having higher priority over shared object repository, hence in all subsequent runs UFT will pick up the updated local object repository.

Test Batch Runner

Test Batch Runner in the UFT’s feature that allows us to run scripts in a batch mode.

Debugging tests

After enhancing the test , now , we need to check, if , it is working fine. or else we need to debug the script. Debugging the test ensures that it is working smoothly without any interruption.Debug will ensure the logic and syntaxes are correct. In Order to detect and isolate the faulty component or the area of the script, we can use the following components

  • Step Into
  • Step Over
  • Step Out
  • Breakpoints
  • Add to watch
  • Pause

Before you proceed further, as UFT is based on VBscript, the maximum syntax and looping abide by the syntaxes of VBScript. So we need to deep drive to VBScript a little bit,

How to Debug a UFT script in VBScript Debugger?
How to Debug a UFT script in VBScript Debugger?

How to Debug a UFT script in VBScript Debugger?

For effectively resolve the error, we need to use the debug process of VBScript or UFT. It is a feature given to any IDE (Integrated Development Environment). Debugging refers to an activity to effectively figure out the root cause of any problem. The problem could be anything:

  • A Bug
  • A logic error
  • A mismatch in requirement
  • A wrong understanding.

It is very important while debugging and learning an Automation framework.

What is Debugging?

Debugging is a process by which we try to detect, locate and omit bugs from our code.

What is Debugger?

A debugger is a two-step process:

  • Identifying an issue
  • fix the issue and retest

A debugger is a tool (a set of codes) that provides insight into the running code in line by line manner. It places itself between compiler or runtime engine and real running of the program.

Even though the main objective of a debugger is to debug and find the issues in the code. But it is equally effective to understand the code, in terms of a logic flow. Without debugging if we need to read and understand the code, it would be a time-consuming process.

Let’s see another important process called maintenance. During this phase, most of the time the person who wrote the code does not fix the code or alter the code. Without a proper debug process, maintainability will go for a toss.

UFT Debug Process

UFT does have a solid debugger which will help us to debug. This post will not talk about UFT debugger but I will discuss how we can debug.QFL or.VBS file outside of the UFT IDE.

Microsoft Debugger

Microsoft Script Debugger is a correct tool that can be used as a debugger of a VBScript file on a system where UFT is not installed.

How to get Microsoft Script Debugger?

UFT/QTP has the debugger inbuilt with the IDE. In case if we are using UFT to debug our scripts, we do not need any other component or debugger.

Just in case, if we are debugging the.VBS file outside of UFT or we want to debug the.VBS file where UFT is not installed, We need to download the Microsoft Script Debugger from here.

After downloading, we need to install the debugger. As it is a Microsoft product, it is safer to restart the machine to take effect.

How to activate Microsoft Script Debugger?

The Microsoft debugger upon installation, attached to itself with WSH.Once we double click on the required.VBS file, the script will execute it via Microsoft Script Debugger.

We have one more option to use debugger via command line. To activate this feature we need to go to Start->Run->CScript.exe and open it.

Once we have opened it, we can use different switches to execute. Switches can be found here.

Microsoft Script Debugger has a great visual representation along with the components mentioned below.

WScript //x {path of the script}
WScript //d {path of the script}

//x switches ask WSH to bring debugger and breaks at the first line.
//d switches ask WSH to bring the debugger if it is needed. It activates the debugger at the preset breakpoint.

Components of Microsoft Script Debugger


This is the important component of the Microsoft Debugger. This will pause execution at a certain line if we use this component and enable it. The objective of the breakpoint is to instruct the WSH engine to stop the execution at the given breakpoint. This component is very useful as it only halts where we want it to halt leaving other lines of code unhalted but executed.

We can open the debugger manually and click on the suspected line. This is the line where the execution will halt. This feature is also available in UFT IDE. This line will be highlighted in yellow and a red circle or dot will indicate the execution is paused.

If we open the script using //x switch, the debugger automatically stops at the first line of the script.

We can set up multiple breakpoints in the script.

With Breakpoint enabled WSH will only stop if one of the below occurs:

  • It encounters an unhandled error
  • It reaches the end of the script.
  • It gets a breakpoint provided by the user.

While breakpoint pauses the execution, these stepping features enable us to go slowly over the line of codes to identify the issue or understand the code.

Stepping is divided into three parts:

  1. Step into
  2. Step over
  3. Step out
Step Into

This component enables us to go into a user-defined procedures, sub or a function. However, we can not go into a function or sub defined by VBScript.Like Msgbox().So to step into a function or sub, the function or sub has to be in the scope of the debugger.

This component goes inside of a custom function or sub or procedure. It starts executing line by line.

Step Over

Once we know the function is good to go, we can use this feature/component. This component instead of going inside the function or sub or procedure, executes them and provides the output directly to the user.

Step Out

This feature finishes the execution of a lower-level procedure or sub or function. It then pauses at the starting of the next line. This is extremely useful when we step into a function or procedure and decide to leave or go out of it.


Step into, Step over, Step Out are just visual representation and stoppage of execution but underlying execution still takes place even if we skip from one component to another.

View Call Stack

This component stacks the nested sequence of function or procedure calls. It provides a hierarchical list of the chain during the execution of our script. It is useful when we have multiple function calls in a chained manner.

WSH engine keeps track of all the calling function’s order until these functions get completed. WSH traverses through the stack to determine the completion of the called functions.

How to Activate Call Stack?

Below steps needs to be performed while activating the call stack.

  • Put a breakpoint in the script.
  • Run the script in the debug mode.
  • While the control stops at the breakpoint, click on the call stack option under view Menu.
  • The call stack window will appear and displays the stack information.

As it is a stack, we need to read from the bottom towards up.

Command Window

This component enables us to query and view active variables. This is very useful when we want to check some value of the variables, functions or sub. So theoretically, it is another strong debugging feature. The command window supports a special technique by which we can query the WSH.

We need to use the “?” question mark to query the WSH. The “?” operator fetches the required information if available in the scope of WSH.The breakpoint and? operator combo provides a powerful technique to view the insight of the script.

Command window can access the intrinsic objects like Err Object. The WSH also has a set of other intrinsic objects available.

Inserting temporary code

Debug mode in Microsoft Script debugger supports to insert temporary custom test code during execution in debug mode. This helps us to test the logic, variable value, flags, etc. This is a very popular technique while debugging and testing a large codebase.


How to Use Debug Message?

The debugger provides a clear insight into a code. While watching/view are temporary and only available during test run/debug session, the debugger provides other ways to save the debug message.

    • Put the debug message to a log file for future reference. A redirecting debug message to a log file is an efficient way for framework development.
    • This is running commentary of the script execution about how and what the script performing from running an Excel macro to a sendkey function.
    • Debug messages enable us to track changes of a variable which we can configure and see how the values are getting changed.
    • The simplest form of debug message is Msgbox() function. It is a great tool to see values. It also pauses the script execution in a modal way until and unless we click on the “Ok” button. The script execution remains halted until then.
      Msgbox "The value is "+myVar
    • The WSH Script uses the Echo() method to display detailed information. It is more preferable over the Msgbox() function. In WScript.exe, Echo method will display the message in a dialog box. If we use several Echo() messages, in our script, we need to click ok again and again.

WScript.Echo "The value is "+myVar
  • The Stdout property of WSH is another feature to transfer TextStream to console. This is only applicable to CScript.exe. In the case of Wscript.exe, Stdout property is not applicable and throws an error.
  • LogEvent() is another method of WSHShell object to log the WindowsEvent log. This method is supported by both WScript.exe and CScript.exe.

What is not supported by Microsoft Script Debugger?

The Microsoft Script Debugger does not support the followings:

  1. A local window to showcase active variables at the breakpoint.
  2. It does not have a watch window
  3. It does not support dynamic breakpoint


UFT/QTP does have these features, so if we are using UFT/QTP instead of Microsoft Script Debugger, these components will be automatically available

The omission of Assertion in UFT and VbScript Debugger

VBScript Debugger or UFT surprisingly does not support the assertion. Also, there is no support for AssertThat() function. We need to depend on if-else and custom message to implement assertion.


While UFT provides a great debugging option, Microsoft Script Debugger is a lightweight debugger that can debug any VBScript used in UFT. It can also work in a UFT neutral system. This feature is a major boost for the Script review process. Surely and certainly Microsoft Script Debugger will increase the speed of review, execution and debug process.

VBScript concepts for UFT Automation testing.

UFT is based on VBScript. It is also required to learn VBScript a little to upgrade UFT scripts.

How to debug UFT script in VBscript debugger?

The tips of tricks of debugging a complex script is very important.

Errors and Error Handling in VBScript

Errors and Error handling is another component that whose knowledge minimizes the maintenance effort.

Defining and exporting test results

Now after the running of the test we need to collect the test results.

How to work with reporter Object?

Reporter Object is very important point to understand reporting via UFT.

Analyzing results:

In this phase we analyze the test results(the passes,fails and warnings). An execution of test may fail due to various reasons. They prime causes are as follows:

  • Checkpoints failed
  • Script error
  • Script could not run due to some external error.
  • Syntax error

In case, Script has passed, it will appear in the result as green. In case script has failed, i n result it will appear as red. For script error , the report may be in warning (color-orange).

Navigation to Report:

Automation menu–>Select Result

By default the UFT will show the latest execution report.

UFT step result
UFT step result

Lets understand the UFT report bits and pieces:

  • The left hand pane displays the test result tree.It is an icon based view of the steps.If the icon does have a + sign associated to it. It signifies that the icon or object can be further expanded. Once we click on the + sign it will further drill down to the steps. Each run in UFT is called iteration. For each iteration the same tree will be created. Iteration has a number associated to it.
  • The right pane shows the test results. It has an iteration summary table. The summary table indicates which iteration has passed and which one is failed. So the summary will tell us how many checkpoints are passed or failed.
  • The last table shows the status summary. It provides an overall view of the passed, failed and warning numbers.
  • The last component of the test result is the active screen. It just shows the screens on which the steps have been performed.

If we want to customize the save images then, we have the following options:

  1. Always
  2. For errors
  3. For errors and warning
The details of Test Tree symbols
GUI Element Description
right The step has passed. It is applicable for tests where a checkpoint or micpass command is attached.
Failed The step has failed. It is applicable for tests where a checkpoint or micfailed command is attached.
Warning The step has completed but having some issue. It is not equivalent to failed.
failed unexpectedly The step has failed unexpectedly. Like object not found.
Warning Informational step or optional step. It is nothing to do with fail or pass status.
Smart Identification This symbol indicates that the object was found by activating smart identification.
recovery scenario This symbol indicates that the script activated recovery scenario.
stopped This symbol indicates that the script execution is stopped forcefully before it’s actual end.
dynamic test object creation This symbol indicates that the test object is not present in the object repository and may have been created using code.
maintenance mode This symbol indicates the maintenance mode run result.
How to jump to a step in UFT run result?

We can view the step in UFT that corresponds to a node in the run result tree. To view the step in the test that corresponds to a node , we need to perform the following steps:

  1. We need to select a node in the test result tree.
  2. We need to perform one of the following tasks
  • We need to click the Jump to Step button available in the Run Result toolbar.
  • We need to right click and select Jump to Step from the context sensitive menu.
  • We need to Select View–>Jump to Step

The UFT is activated and the step is highlighted.

For a successful Jump to a Step, the following conditions should be always true.

  • UFT should be up and running.
  • The test must be opened whose results are displayed in the test result window.
  • The test must run in an UFT which supports Jump to Step functionality.
  • The node should have a corresponding step in the script. However note that the feature is disabled for the Action,Iteration,Runtime data table,Test Summary nodes.
  • The recovery scenario has not been performed on the step we are targeting.
  • The step has not run via command tab or watch tab of the debug viewer.
  • The step was not part of an action which was triggered by the LoadAndRunAction command.
  • The test is saved before run session.
  • The test is run in normal mode.

So many conditions to find a step?? No dude. I do not suggest this steps. Rather you can check the result and by debugging you can find the test. Try not to use automatic step finder, instead we need to use logic to find the step.

Test reporting:

In this phase we report as per SLA criteria.The execution report we received in the previous step can be analyzed manually to report any issues. If the UFT is attached to QC or ALM , we can export the failed test as bug.

To log a defect we need to navigate :

Test Menu–>Tools–>Select the issue–>Add defect

We can export the test result details to the following formats:

  1. HTML
  2. PDF
  3. DOC

This means whenever the test result viewer is not available, we can view the results in the above written formats. A popular example and reason to export one of the format is when we send the test result over network via shared drive or email. In that case, in that machine the UFT run result viewer may not present. These formats come handy then.

We need to go to Export Report submenu. the export report has the following conditions:

  1. Export Range (All or selection)
  2. File Type(HTML,PDF,DOC)
  3. Export format(short,detailed,user defined XST)

How to write custom HTML file?

Refer the post in URL to know in detail on how to write custom HTML reports.

Viewing System monitor results

The system monitor tab in the test result window shows how the system was behaving during test execution. It is not widely accepted monitoring tool. We can safely ignore this feature.

Defect Reporting using companies defect management system.:

In this phase ,we log defects in defect management system like-excel,bugzilla,QC etc.

Modifying tests:

After the defect fix or a case of new build we generally modify our tests.Why it is required??? just to save ourselves from pesticide paradox.

Performing re and regression testing

In this phase we generally run performance and regression testing again.

Advanced UFT topics:

How to Capture Events

Read here for capturing events.

Introduction to Dictionary Object

Dictionary object is the list containing key value pairs.

How to work with Optional Step?

An optional step is a step that is not necessarily required to successfully complete a run session. During a run session, if a step in an optional dialog box does not open, QuickTest bypasses this step and continues to run the test. When the run session ends, a message is displayed for the step that failed to open the dialog box, but the step does not cause the run to fail.

What is automation framework?

Automation framework is the next thing we need to know.

Regular expression in UFT

Regular expression in UFT allows to work with patterns for input and output verifications.

Assets of UFT/QTP with Extension

Test Assets Extension
Test File .mtr
Shared Object Repository .tsr
Local Object Repository .mtr
Test Batch runner .mtb
Recovery scenario .qrs
Function Library .qfl
Results .xml


Transactions in UFT

Transaction is a technique to measure how long it takes to run a section or part of the script in our test. A transaction represents the process in our application that we are interested to measure. A Transaction can be inserted anywhere of the code in our test .

Most importantly transactions should be placed within the same action. Transactions are mostly placed around a point where some sort of transaction is happening.

During the test execution, the start transaction provides a signal for beginning of a time measurement. It also soft signals that a transaction is also underway.  The timer will keep updating till it gets the end transaction signal. End transaction also soft signals that the a transaction is typically over. The report will display the time for a transaction to happen.

How to insert a Transaction

A transaction must have two components.The components are:

  • Starting of transaction
  • End of transaction.
Start Transaction

To insert a start transaction we need to perform the following steps:

  • We need to click or select on the step where we want to put a start transaction. The same page or window is displayed on Active Screen tab.
  • We need to click on Start Transaction button or choose Insert->Start Transaction. The Strat Transaction window will open.

We have to provide the below:

  • A meaningful name for the transaction like-MeasureDatabaseConnectionSpeed
  • Where to insert the statement(before current step or after current step)
  • we need to Click on ok .

In keyword view we can see the code similar like-

Services.StartTransaction "MeasureDatabaseConnectionSpeed"
End Transaction

To insert end  transaction we need to follow the below steps:

  • We need to select the step where we want to end the transaction.
  • We need to click on End Transaction or click on Insert->End Transaction. This will open up the end transaction dialog box.
  • The window will contain all the transaction name we have created during our script development.
  • From the drop down we have to choose the transaction name we want to end.
  • There are two options to place the end transaction code. (before the current step and after the current step).
  • We need to click ok to end the transaction.

In keyword view we can see the code similar like-

Services.EndTransaction "MeasureDatabaseConnectionSpeed"

Very best Techniquesda in QTP/UFT Automation

  • Begin your automation function only when AUT (Application under Test) is stable. ie You should really have done initial spherical of handbook testing in advance of beginning QTP automation activity.
  • Use reusable actions wherever achievable.
  • Do not copy and paste checkpoints when you would like to check exact point in more than just one sites. As a substitute, build different checkpoints. Mainly because manipulating checkpoints in QTP is not feasible or it will be hard.
  • Open up browser / application right after opening QTP.
  • Your vbscript capabilities really should not have any difficult coded item names, the name of the objects should be handed as operate argument.
  • Use Shared Item Repository. My recommendation is do not use DP (Descriptive Programming) which will maximize your maintenance do the job.
  • Before introducing any object to Object Repository, set up ideal object identification attributes (in Resources-> ObjectIdentification) if you feel that default identification qualities are not suitable for you software. If you do it just after incorporating some objects to the Item Repository then you could facial area issues similar to having Many Exam objects in Item Repository for a solitary actual Item.
  • Open up QTP working with the Automation item model. You can do it just by writing ( even you are acquiring ‘ script’ solution in the QTP IDE by itself ) simple .vbs file, and then open up QTP just by double-clicking this .vbs file. It is quite pretty vital if you are building your scripts in a person device/atmosphere and arranging to operate/execute it in another atmosphere. By applying the Automation Object model we are creating guaranteed that all the IDE options (eg Item identification attributes) that are adjusted in enhancement ecosystem are propagated to the execution ecosystem also
  • Normally use Reference / Relative path when calling any external reusable motion rather than employing complete/full path, In any other case, the script will fall short when positioning it in the various paths.
  • Remember to get backup of Item Repositories in advance of rising object repositories.
  • Put good inline responses and also place summary opinions ( description, enter & output parameters, dependency, author ) at commencing of the Examination. In the comments try to remember to mention execution/facts move.
  • Rename the Objects in Item Repository to have suitable that means for them. Due to the fact, the default identifies supplied by including the objects by recording or manually may possibly not be great/meaningful.
  • Give interest to synchronization (ie use of sync, waitproperty, exist). And also use the normal expression the place expected. Or else consistency of script execution will be influenced.
  • Use restoration circumstance to handle any unpredicted conduct ( eg showing pop-up windows occasionally ) of the software.

How to Use a Parentheses in QTP or UFT?

Parentheses or Cannot use parentheses when calling a Sub or Call a Function in UFT
Parentheses in UFT or VBScript

Using of parenthese in UFT/QTP or VBscript is different than other programing languages. This post talks about how to Use Parentheses in UFT or QTP,How to Call a Function in UFT,how to Call a subroutine in UFT. After reading this post I hope you will be clear on where to use parentheses and where not to use parentheses.This post also tells why the issue-“Cannot use parentheses when calling a Sub” comes and How to resolve Cannot use parentheses when calling a Sub error.

What is the meaning of Parentheses in VBScript or UFT?

Parentheses are mostly used in subroutine calls,function calls,array declarations,array accessing, evaluating part of expression,passing value by ByVal or ByRef.

Lets see theses example one by one.

Parentheses in Subroutine and Functions

General Idea about parenthese

To achieve the desired result and to avoid errors, it is important that you use parentheses () correctly in your statements. For more information, see below…
You must use parentheses around method arguments if you are calling a method that returns a value and you are using the return value. For example, use parentheses around method arguments if you are returning a value to a variable, if you are using the method in an If statement, or if you are using the Call keyword to call an action. You also need to add parentheses around the name of a checkpoint if you want to retrieve its return value.
Tip: If you receive an Expected end of statement error message when running a step in your test, it may indicate that you need to add parentheses around the arguments of the step’s method.
Following are several examples showing when to use or not use parentheses.

Impact of parenthese on Subroutine

A subroutine is a group of statements that does not return any value. A subroutine may or may not take arguments. So based on arguments , subroutines can be classified into two broad categories:

  1. Subroutine with arguments
  2. Subroutine without arguments

Let’s look into the structure of subroutines with argument

Sub MySub(sName,intTotal)
//body of the sub
End Sub

In this case (Subroutine) since it is accepting arguments, they need to be inside parentheses. This is the standard structure syntax of Subroutine.

Let’s look into the structure of subroutines without argument

Sub MySub
//body of the sub
End Sub

How to call the Subroutine?

There are two ways to call a subroutine. They are as follows:

  1. Directly by name.
  2. Using VBScript’s call keyword
Calling directly by subroutine name

While calling a subroutine by its name, we do not need to pass any argument, so we do not need any parenthese.



For calling subroutines with arguments, we still do not need parenthese. The arguments are separated by comma(,).


MySub "Test",10
MySub sName,intTotal

In case you call a subroutine with parenthese,you will get runtime error “Cannot use parentheses when calling sub”.This is the main reason why we get Cannot use parentheses when calling a Sub issue.

Using VBScript’s Call keyword to call a subroutine

The use of keyword ‘call’ is purely optional when we to call a subroutine. Call keyword is only applicable when the subroutine accepts arguments and they are enclosed in parentheses. In case our subroutine does not accept any argument, there is no need to use parentheses.


Call MySub
Call MySub(sName,intTotal)
Call MySub("Test",10)

Parenthese on Function:

Let’s look into function now. function is a group of statements that can return some value. There are two possible ways we can call a function.

  1. By using name
  2. By Using VBScript keyword-Call
Calling a function by using directly Name

When we call a function that does not have an argument or any return value, we can use the followings


In case the function has some argument and does not return any value we can use the following:

MyFunc sName,intTotal
MyFunc "Test",10

Scenario changes when our function has some return value:


In this case, If you have one or more arguments, then it is a must to use parentheses.

Using Call keyword to call a function

If a function has arguments,you must need to put parentheses while using call keyword. the arguments are separated by commas.

Note: If you use Call keyword to call a function, it can not return a value.


Call MyFunc(sName,intTotal)
Call MyFunc("Test",10)

This is how we Call a subroutine in UFT.

Parenthese on Array

Parentheses can be used on Arrays in VBScript.

Dim myArray(3) ' will create an array of size-4

We can access any array element by using parenthese, like


Impact of Parentheses on Expression

Parentheses can be used to change the priority of an arithmetic expression. Like

(2+4)*3 evaluates 18 instead of 14

Impact on ByRef and ByVal

VBScript supports ByRef and ByVal keywords to specify the parameters passed either by reference or by value. When arguments are passed by value,any change inside the function/sub will not carried to outside of the scope.

On the other hand, if arguments are passed by reference, the changes to the variable becomes permanent and are available outside of the functions/Subs.

By default,all values are passed by reference.

Sub MySub(y) //by default pass by reference
y="Test default"
End Sub
Sub MySub(ByVal y) 
y="Test By val"
End Sub
Sub MySub(ByRef y) 
y="Test by ref"
End Sub
msgbox y
MySub(ByVal y)
msgbox y
MySub(ByRef y)
msgbox y

Test these and let me know in comment what is your output.

How to Use a Parentheses in QTP or How to Use a Parentheses in UFT?

To achieve the desired result and to avoid errors, it is important that you use parentheses () correctly in your statements. For more information, see below…
You must use parentheses around method arguments if you are calling a method that returns a value and you are using the return value.

For example, use parentheses around method arguments if you are returning a value to a variable if you are using the method in an If statement, or if you are using the Call keyword to call the action. You also need to add parentheses around the name of a checkpoint if you want to retrieve its return value.

Tip: If you get an Expected end of articulation error message when running a stage in your test, it might show that you have to include brackets around the contentions of the progression strategy.Call a Function in UFT also follows the same principal.

Following are a few precedents appearing at use or not utilize brackets
The following example requires parentheses around method arguments since it returns a value to a variable.

Set WebEditObj = Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").ChildItem (8, 2, "WebEdit", 0)
WebEditObj.Set "Example"
The following example requires parentheses around method arguments, since Call is being used.
Call RunAction("BookFlight", oneIteration)
The following example requires parentheses around method arguments, since the method is used in an If statement.
If Browser("index").Page("index").Link("All kind of").WaitProperty("attribute/readyState", "complete", 4) Then
Browser("index").Page("index").Link("All kind of").Click
The following example requires parentheses around method arguments, since it returns the value of the checkpoint.
a = Browser("MyBrowser").Page("MyPage").Check (checkPoint("MyProperty"))
The following example does not require parentheses around the Click method arguments, since it does not return a value.
Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").Click 3,4

The following example requires parentheses around method arguments, since it returns a value to a variable.

Set WebEditObj = Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").ChildItem (8, 2, "WebEdit", 0)
WebEditObj.Set "Example"

The following example requires parentheses around method arguments, since Call is being used.

Call RunAction("BookFlight", oneIteration) 

The following example requires parentheses around method arguments, since the method is used in an If statement.

If Browser("index").Page("index").Link("All kind of").WaitProperty("attribute/readyState", "complete", 4) Then
Browser("index").Page("index").Link("All kind of").Click

The following example requires parentheses around method arguments, since it returns the value of the checkpoint.

a = Browser("MyBrowser").Page("MyPage").Check (checkPoint("MyProperty"))

The following example does not require parentheses around the Click method arguments, since it does not return a value.

Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").Click 3,4

Let me know what do you follow to Call a Function in UFT? or Call a subroutine in UFT?

Now lets see why we get cannot use parentheses while calling a sub error-Microsoft VBScript compilation error ‘800a0414’

Definitely, we have invoked a subroutine without a call statement but may have used parameters. So the best way to resolve this issue while calling a subroutine without a call statement , do not use parentheses.

How to correct cannot use parentheses while calling a sub error-Microsoft VBScript compilation error ‘800a0414’? or How to resolve Cannot use parentheses when calling a Sub error?

  1. Use call statement to invoke the subroutine.
  2. Remove parentheses from the subroutine invocation.
Final note on parentheses

When you enclose a procedure’s arguments in parentheses, you must use the call statement and when you remove call keyword, you must remove parentheses. This concept is also helpful to design your framework in automation. Let me know your views on Call a Function in UFT or Call a subroutine in UFT or How to resolve Cannot use parentheses when calling a Sub error by commenting below.

MSDN,StackOverflow-1537819,StackOverflow-14902134,Call Statement-MSDN

How to Capture Tool tip Through QTP or UFT Script

Most of the time we use to get this requirement that we need to capture tool tip through QTP. Sometimes we need to check a page with the tool tip.
In the web, this is a very powerful tool to work with automation. we can say in other words in automation in checkpoints it is really a great tool to verify a page, table, image.
Below script is for capturing tool tip of the textbox in Google Site.

msgbox getToolTip
Function getToolTip()
getToolTip= tooltip_name
End Function

What are GetROProperty,GetTOProperty,GetTOProperties and SetTOProperty in UFT?

Developers develop an application with different elements in any technology.They provide or maintain some basic information about the element.
Now While automating such an application using UFT/QTP, we rely on UFT/QTP.It has its own mechanism to identify and learn about such properties of the application. These are standard object properties.
To begin with, let us understand a few basic things…

  • TO–Test Object[standard]
  • RO–Runtime Object[standard]
  • Get–To fetch some value [kind of getter]
  • Set–To set some value [kind of setter]


Mercury now HP has created or defined Test objects according to the supported environment (web,ERP,Java etc).When UFT/QTP records an application,it tries to match the same list of properties for an Object and store them in Object Repository.

Navigate to Tools–>Object Identification
you can see the HP given/created Test Object properties:

For quick and steady access UFT/QTP stored them in registry as well:
The Path would be:
HKEY_CURRENT_USERSoftwareMercury InteractiveQuickTest ProfessionalMicTestTest Objects<<ObjectName>>Properties
HKEY_LOCAL_MACHINESoftwareMercury InteractiveQuickTest ProfessionalMicTestTest Objects<<ObjectName>>Properties
depending upon license and installation.
For Browser
HKEY_CURRENT_USERSoftwareMercury InteractiveQuickTest ProfessionalMicTestTest ObjectsBrowserProperties

However all these properties can be found under Help section of UFT/QTP.

In this post I trying to clarify different operation can be made through UFT/QTP on these objects.

When we do little advance programming in UFT/QTP, We need to fetch the value from the UAT. That becomes a standard requirement in UFT/QTP. Fetching value from application during run time was not so easy.UFT/QTP’s advance programmer made it easy for all of us.

The technique is named as GetROPropery [Get Run time Object Property]

This command deals with the current value of the element.This can fetch values associated with runtime object.[During execution]. It can only be used on the properties that an element support during execution. Use Object Spy tool to identify compatible properties who’s value can be fetched.We can use Regular expression too.


Browser("Google").Page("Google").WebEdit("q").set "AskUFT/QTP"
msgbox Browser("Google").Page("Google").WebEdit("q").getROProperty("Value")

It supports descriptive programming as well.

dim class_Name as String

Name_of_variable[String]=<Fully Qualified DOM>.ObjectType<Object unique identifier>.getROProperty(“Property Name”)

Where we can use GetROProperty?

Mostly finding combo items,getting title,getting table size,We will be using this methos.
It is bit advanced than standard or text check point.

How To Retrieve Value from Webelement in UFT/QTP/UFT?

Scenerio is:-

1)We have an object as WebElement whose value is dynamically changing.For example,say i want to retrieve a policy number.When i added that object and retrieve with GETROPROPERTY,it is retrieving only one value which is added in the OR.For the next iteration it is throwing an error saying cannot find object.

In this scenerio, we use regular expression,but using that it didnt helped.What are the other way to solve this issue?Please help me regarding this.

If the value of the webelement changes then getROProperty sometimes do not work …
As you are capturing policy number. So i assume that it changes from policy to policy.
I dont know your application. I am assuming it is on Web and written on any of the web language.
I am taking an example of Gmail home page where the third space “Lots of space” is getting changed time to time.

How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

So if you add this and try to use the function getROProperty ,then the problem you will face is like this only…

How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

The alternative approaches are:

1.Please try to include additional properties inorder to make the webelement get identified as they could have added extra properties.Spy the object get the porperties for the extra properties
2.You can update the webelement from the application into the object repository and make sure class of the object is not changed.

How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

Browser("Google").Navigate http://www.google.co.in/
msgbox Browser("Google").Page("Gmail: Email from Google").WebElement("place").GetROProperty("innertext")
How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

3. if the above approah does not give you the required result please try this…


Set childobjdes = Description.Create()
childobjdes("outertext").value =".*[A-Za-z0-9].*"
Set oWebElement = Browser("Google").Page("Gmail: Email from Google")
Set oStyle = oWebElement.Childobjects(childobjdes)
msgbox oStyle.count
For i=o to oStyle.count-1
msgbox i &"-" & oStyle(i).getROProperty("outertext")


How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

So you can exactly get the Element no and track your required no.

4. If all the above code does not give you the required result then you can actually go for this concept.
If you really see the webpage…this is a table structure. even UFT/QTP identifies those tables…the values of this space or policy number (for your case) is coming to cell of a table.

How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

Now you need to add these tables to your OR. atleast the last table..

r= Browser("Gmail: Email from Google").Page("Gmail: Email from Google_2").WebTable("Less spamKeep unwanted").RowCount
c= Browser("Gmail: Email from Google").Page("Gmail: Email from Google_2").WebTable("Less spamKeep unwanted").ColumnCount(r) For i=1 to r 
For j=1 to c 
msgbox Browser("Gmail: Email from Google").Page("Gmail: Email from Google_2").WebTable("Less spamKeep unwanted").GetCellData(i,j)
How To Retrieve Value from Webelement in UFT/QTP/UFT?
How To Retrieve Value from Webelement in UFT/QTP/UFT?

From the string you can find the policy number.

Hope this will help you.

GetTOProperty can fetch values associated with test object residing in Object Repository.In simple words,this command or function returns the properties and values which UFT/QTP has learnt during recording of the flow. It stores all values in Object Repository. During run time, UFT/QTP tries to match the same values with application’s object to identify and perform operations..It reads all the value from object description.This can be used instead of standard check point to compare static values.

Variable_Name[of type String]=<Fully Qualified DOM>.ObjectType<Object unique identifier>.getTOProperty(“Property Name”)

dim class_Name as String

It supports descriptive programming as well.

dim class_Name as String

During the use of GetTOProperty, many of us get the error called “Invalid procedure call or argument”. Most likely this error comes when we are trying to get property value which is not listed or learnt by UFT/QTP during recording time.Use Object Spy to get the correct set of value to be fetched from object property.All it fetches the basic static properties of the test object.
This is one advanced command or method over GetTOProperty. GetTOProperty deals with a single value. GetTOProperties can fetch multiple properties from a test object.Again the basic is same. These values need to be stored in Object Repository.
Variable_Name[of type String array]=<Fully Qualified DOM>.ObjectType<Object unique identifier>.getTOProperties

dim object_properties as String array
dim name as String
dim alt as String
systemUtil.Run "iexplore.exe","http:/Google.com"
'Open google
Set ObjectEditBox=Browser("Google").Page("google").webEdit("q")
Set object_properties=ObjectEditBox.GetTOProperties
/This will fetch all TOProperties associated with editbox in the form of string array
for i=0 to object_properties-1

This method or command is used to modify a property value that UFT/QTP has learned during the record session and stored in Object Library. During recording UFT/QTP stores application properties and values in the Object repository and during a run session it creates a replica of the same.

Then, tries to match all the properties and its corresponding values. By SetTOProperty we change the replica version of those object’s property. So it is temporary and valid for each run session. After the run, UFT/QTP restores the original values.

In this case, the yellow box the original properties and values do not get affected. Mostly when there is no way to identify the object and no information available in Object Repository about the object we follow this approach to make UFT/QTP understand the new Object.
Say on a page there two links available for a table view.

  1. GoNext-Upon clicking this Application will produce next 10 records
  2. GoPrevious-Upon clicking Application will produce the previous 10 records.

So when we recorded, UFT/QTP learn about these two objects and stored in Object Repository. Now due to requirement change or any temporary change, it becomes “Next” and “Previous”. The working mechanism is the same. As this is a temporary change so we will not change the Object Repository ,rather we will change the way UFT/QTP identifies these object in such case SETTOProperty will be handy. For that, we will change the name property of these buttons.

Browser("ABC").Page("XYZ").webButton("GONext").SETTOProperty "name","Next"
Browser("ABC").Page("XYZ").webButton("GOPrevious").SETTOProperty "name","Previous"

The only thing to remember before applying SETTOProperty is to disable the UFT/QTP’s Smart Identification mechanism to identify the Object. Secondly, it is done in an encapsulated manner hence the screen (Active) or the Object Repository. So they will remain unchanged.

One more scenario could be, when we need to work with multiple instances of the same page, all objects will be the same for this case. So while testing such instance we will be using SETTOProperty to identify them uniquely by providing separate names.
This is not available in UFT/QTP. Rather not required at all. During Runtime UFT/QTP is going to set the value anyway. This technique is important when UFT/QTP can not identify a text filed or some operation that UFT/QTP can not perform. We will adopt a javascript executor in such a case. Few UFT/QTP codes say it as SetROProperty. Let us discuss how:

set page=Browser("Google").Page("Google")
'setting the object for page
set googleTextBox=page.RunScript("document.getElementByName('q')(0);")
'Setting the object after finding in DOM

We can use getElementByID,getElementByXpath etc remember this is for fun and UFT/QTP does not have this method.

READ  SystemUtil.Run method in UFT Learn Here for Free


  1. Hi Animesh,

    This is kumar from chennai. I am a Newbie in QTP. I found your blog. I have following questions poke in my mind. Pls answer my questions:

    a) How to start QTP (Before i start what are things i should do)
    b) Could you pls give me 'Sample automation frame work' and how to create?
    c) Could you pls give me a any QTP use guide (If you have)


  2. After doing this vegetables and fruit focus upon landing
    world-wide-web site. Seaech Engine Optimization factor
    that actually is important ffor businesses in today’s times.
    In addition, they can also reduce the page ranking.

  3. Peoplle believe the latest versjon iis often the utmost.
    It is the only profession your own do not answer to anyone and so your oown boss.
    While trading live there is just not time to think.

  4. A website article can also enhance your website’s rank in all of the major web presence.
    So I think forr your seo wofk we end up being go wirh good
    satisfied. So, it goes without proclaiming that ‘title’ is crucial.

  5. I have read some just right stuff here. Certainly worth bookmarking for revisiting.
    I surprise how much attempt you put to create the sort of
    great informative web site.

  6. I’m gone to convey my little brother, that he should also pay a
    quick visit this weblog on regular basis to get updated from newest

  7. Reall are millions numerous free Swediish dating site that offer
    a lot of interesting individuals. When you’re
    not in cosmetic treatments have a swim your
    center’s bunch.

  8. I’m trying to change the entire background of my blogspot. I can get it on the left side, but the sidebar still remains at the ugly solid color. any help?.

  9. You actually make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it.

  10. whoah this blog is wonderful i like reading your articles.
    Stay up the good work! You know, many people are looking round for this information, you could help them greatly.

  11. Don’t be rash with a decisions, but mae calculated risks.A
    stop loss is important, buut bee realistic and so tthat you
    cann wide suitable. The concept of binary options is undemanding.

  12. That is a good tip particularly to those new to the blogosphere.

    Simple but very accurate information… Appreciate your sharing this one.

    A must read post!

  13. Whoa! This blog looks exactly like my old one! It’s on a totally different subject but
    it has pretty much the same page layout and design. Superb choice of colors!

  14. It takes skill, determination, and doing its job a team to play football
    competently. It’s not really about playing the game but it’s
    more like really experiencing and enjoying the game.

    I actually attended anny of the while at school.

  15. Excellent post. I used to be checking constantly this blog and I am impressed! Extremely useful info particularly the last phase 🙂 I handle such info a lot. I used to be seeking this certain information for a long time. Thanks and best of luck.

  16. Heya i’m for the primary time here. I found this board and I find It truly useful & it helped
    me out a lot. I’m hoping to provide something again and aid others such as you helped

  17. Nice weblog right here! Also your website lots up fast!
    What web host are you the use of? Can I get your
    associate link to your host? I want my site loaded up as fast as yours lol

  18. whoah this weblog is excellent i like reading your posts. Stay up the good work! You recognize, many persons are searching round for this information, you could help them greatly.

  19. I know this website provides quality depending posts and other material, is
    there any other web page which gives these kinds of data in quality?

  20. Hey there, You’ve done an incredible job. I’ll definitely digg it and personally suggest to my friends. I am confident they will be benefited from this web site.

  21. This is when you will decide to understand a person can view the markets.
    You wjll have to system to make iit worse buying and selling resolutions.
    Again I ask why are you trying to kill me aand my friends.

  22. Just desire to say your article is as surprising.
    The clarity to your put up is just nice and
    that i can assume you’re an expert on this subject.
    Well together with your permission let me to clutch your
    feed to stay up to date with approaching post. Thank you one million and please carry on the enjoyable work.

  23. Amazing! This blog looks exactly like my old one!

    It’s on a completely different topic but it has pretty much
    the same layout and design. Excellent choice of colors!

  24. A motivating discussion is worth comment. I think that
    you need to write more on this issue, it may not be a taboo matter but generally people
    don’t speak about such issues. To the next! Kind regards!!

  25. Hello i am kavin, its my first occasion to commenting anywhere, when i read this post i thought i could also create comment due to this good piece of writing.

  26. I will right away grasp your rss as I can’t find your e-mail subscription link or newsletter service.
    Do you have any? Kindly allow me recognize in order that I may subscribe.

  27. Fantastic goods from you, man. I have understand your stuff previous to and you’re just extremely fantastic.
    I actually like what you have acquired here,
    certainly like what you are saying and the way in which you say it.
    You make it enjoyable and you still take care of to keep it wise.
    I can not wait to read far more from you. This is actually a tremendous web site.

  28. Hey there! This post could not be written any better!
    Reading through this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this page to him.
    Fairly certain he will have a good read. Many thanks for sharing!

    That is why I want to share with you what motivated me to develop and earn money,
    maybe it will help someone

  29. Hello! I know this is kind of off-topic but I had to ask.
    Does running a well-established website such
    as yours require a large amount of work? I’m brand new to writing a blog but I do write in my journal
    everyday. I’d like to start a blog so I can easily share my
    personal experience and feelings online. Please let me know if you have any kind of recommendations or tips for new aspiring blog owners.

    Appreciate it!

  30. Everyone loves what you guys tend to be up too.

    This type of clever work and exposure! Keep up the terrific
    works guys I’ve included you guys to my own blogroll.

  31. After looking at a number of the blog articles on your web page,
    I truly like your way of writing a blog. I saved it to my
    bookmark webpage list and will be checking back in the near future.
    Please check out my website too and let me know what
    you think.

  32. My brother suggested I may like this blog. He was once
    totally right. This post truly made my day. You can not believe simply how a lot time I
    had spent for this information! Thanks!

  33. Hey there! I realize this is kind of off-topic
    however I needed to ask. Does running a well-established
    blog like yours take a lot of work? I am completely new to operating a
    blog however I do write in my diary everyday. I’d like to
    start a blog so I will be able to share my own experience and views online.
    Please let me know if you have any ideas or tips for new aspiring blog owners.
    Appreciate it!

  34. I think this is one of the most important info for me.
    And i am glad reading your article. But should remark on some general things, The website
    style is wonderful, the articles is really nice
    : D. Good job, cheers

  35. Very shortly this web site will be famous among all blogging and site-building visitors, due to it’s good content|

  36. It is perfect time to make some plans for the longer term and it’s time to be happy.

    I have learn this post and if I may just I wish to counsel you few interesting
    things or tips. Maybe you can write subsequent articles referring to this article.
    I wish to read even more issues approximately it!

  37. Link exchange is nothing else except it is simply placing the
    other person’s weblog link on your page at suitable place and other
    person will also do similar in support of you.

  38. I am sure this article has touched all the internet visitors, its
    really really nice paragraph on building up new blog.

  39. Hi there all, here every one is sharing such experience, therefore
    it’s good to read this weblog, and I used to pay a quick visit this web site all the time.

  40. I’m gone to convey my little brother, that
    he should also pay a quick visit this webpage on regular basis
    to take updated from newest news update.

  41. After exploring a handful of the articles on your website,
    I really appreciate your technique of blogging.
    I bookmarked it to my bookmark webpage list and will be checking back soon. Take a look at my website
    too and let me know your opinion.

  42. I am not sure where you’re getting your information, but great topic.
    I needs to spend some time learning much more or
    understanding more. Thanks for magnificent information I was looking for this information for my mission.

  43. I don’t even know how I ended up here, but I thought this post was
    great. I don’t know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  44. I’ve read several good stuff here. Definitely price bookmarking
    for revisiting. I surprise how so much attempt you set to
    make any such wonderful informative website.

  45. Hurrah! After all I got a webpage from where I know how to truly get useful data concerning my study and knowledge.

  46. I really like your blog.. very nice colors & theme.

    Did you make this website yourself or did you hire someone to
    do it for you? Plz respond as I’m looking to construct my own blog and would like to know where u got this from.


  47. I visit every day a few web sites and information sites to read articles,
    but this website gives quality based posts.

  48. Your method of telling all in this article is really pleasant, all be capable of effortlessly be aware of it, Thanks a lot.

  49. Hello to every , for the reason that I am in fact keen of reading this
    webpage’s post to be updated daily. It contains nice information.

  50. you are actually a just right webmaster. The site loading pace is amazing.
    It seems that you’re doing any unique trick. Also, The contents are masterpiece.
    you have performed a wonderful activity in this subject!

  51. For newest information you have to pay a quick visit
    the web and on internet I found this web page as a finest site for most recent updates.

  52. An interesting discussion is worth comment. I do think that you ought to
    write more about this subject, it might not be a taboo matter but generally people don’t speak about such topics.
    To the next! All the best!!

  53. It’s not my first time to visit this website, i am browsing this
    site dailly and take pleasant data from here every day.

  54. Howdy! Someone in my Myspace group shared this website with us
    so I came to give it a look. I’m definitely loving the information. I’m bookmarking
    and will be tweeting this to my followers! Terrific blog and brilliant style
    and design.

  55. Hi, Neat post. There is a problem together with your site in web explorer, may
    check this? IE still is the market chief and a good section of folks will miss your fantastic writing because of
    this problem.

  56. you are truly a excellent webmaster. The website loading speed is amazing.

    It sort of feels that you are doing any unique trick. In addition, The contents are
    masterpiece. you’ve performed a wonderful task in this topic!

  57. What’s up i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i
    could also make comment due to this sensible article.

  58. Wow! Finally I got a weblog from where I be capable of actually
    take valuable information regarding my study and knowledge.

  59. When some one searches for his necessary thing, so he/she
    desires to be available that in detail, therefore that thing is maintained over here.

  60. Sweet blog! I found it while searching on Yahoo News. Do you
    have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!

  61. First of all I would like to say wonderful blog!
    I had a quick question which I’d like to ask if you do not mind.
    I was interested to find out how you center yourself and clear your mind prior to writing.

    I have had a tough time clearing my mind in getting my ideas out there.
    I truly do enjoy writing but it just seems like the
    first 10 to 15 minutes tend to be wasted simply just trying to figure out how to begin. Any ideas or
    tips? Thank you!

  62. First off I would like to say awesome blog! I had a quick question in which I’d like to ask
    if you don’t mind. I was curious to find out how you center yourself and clear your thoughts prior to writing.
    I’ve had a hard time clearing my mind in getting my thoughts out.
    I do take pleasure in writing however it just seems like the
    first 10 to 15 minutes are lost simply just trying to figure out how to begin. Any
    recommendations or tips? Appreciate it!

  63. I think the admin of this site is really working hard in support
    of his website, as here every material is quality based

  64. Hey just wanted to give you a brief heads up and let you know
    a few of the images aren’t loading correctly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show
    the same outcome.

  65. I’m not that much of a internet reader to be
    honest but your blogs really nice, keep it up! I’ll
    go ahead and bookmark your website to come back later on. All the best

  66. Wow, that’s what I was searching for, what a material!

    existing here at this webpage, thanks admin of this website.

  67. The most effectivfe SEO technique is to index the pages of new website.
    There aree lot of important issues, one should tqke care.
    We provide a simple guide steps to help you normally indicate.

    Thee critical link using is a one-way network. Google loves uch a of backlink because it believes this shows your popularity.
    A one-way link llooks similar to it gets nothing in return, therefore just lionking in orfder to the excellence of the website
    and making dollars lopk good to msn. Well, the issue iss that, getting a one-way link
    is very difficult. Many websites WILL want something in return, bbe it money, another link starting from
    a different website, oor other services.The best way drvelop this kind of link might be to find free directories or websites enable sbmissions or postings
    of links. Many link builing services post comments or forum posts with a website link
    back towards the website, creating one-way references.

    Most of SEO Company give Website Optimization along with
    Off Pagge optimization as well as include an extensive term Off-page optimization enhance rankings
    which add huge cost to promote any internet sites. Yes,
    it aids in ranking systems oof companhy actually does not work on pages properly tto ensure it always be the best page iits competitor.
    Because require a mind game and knowledge to see various
    factors to do on page Optimization. Most of SEO expert normally working on some Meta tags and bit of words.
    But is the relevancy for this same with enmtire page, they do not know.

    Blog marketing to earn means that you will bee simply blogging
    for soje cash.There is set amount of money youu probably wil
    make from blogging as long as you stay focused,
    persistent and uniform. To make the best of your efforts, there
    are certain techniques and tools you have to know.

    Below are a feww tips which.

    Now, after determining the right type of link you need to build, you wikl
    have to find obtaining website to place it high on.
    Since search engines rank the pagbes and nno thhe websites, you need
    to be sure how the page below is planning on placed in is a good page with
    good traffic aand appearance engine detection and
    understanding. See, iff the link to your internet site is coming from a bad website, Google will
    think your websites are bad too which contributes to less site recognition.

    If are generall in requirement somke fast money, i then would recommend
    you look ino getting discharge Wealth Package. It has bsen the #1 biggest selling product
    for home based business accomplishments.
    It goes over internet in depth as welll as alpt of different ways to
    make multiple streams of income with. Contains shows you
    you can boost revenue through your blog and evrn shows you other strategies too promote your goods for unfastened.

    Backlinks are links pointing back to your personal website business sites.
    Not merely limited to jst any sites though; these arre
    sites in which related and complementary to your content of your website.

    To do well with intertnet article writing youu need to offer directions with
    with your article. Completed read articles to gain information on subjects regarding how too generate money
    online, how you can look younger, or would like a better recipe.
    So give them some useful information that they can use.

  68. I’m really impressed with your writing skills and also with
    the layout on your weblog. Is this a paid theme or did you customize it yourself?

    Either way keep up the excellent quality writing, it is rare
    to see a great blog like this one today.

  69. This is the perfect site for everyone who wants to find out about this topic.
    You understand so much its almost tough to
    argue with you (not that I actually will need
    to…HaHa). You definitely put a new spin on a subject that’s been written about for decades.
    Great stuff, just great!

  70. Hi there everyone, it’s my first pay a quick visit at this website,
    and paragraph is truly fruitful in support of me, keep up posting these types of content.

  71. Pretty nice post. I just stumbled upon your blog and wanted
    to say that I’ve really enjoyed surfing around your blog posts.
    After all I’ll be subscribing to your feed and I hope
    you write again very soon!

  72. Wow, that’s what I was exploring for, what a data!
    present here at this webpage, thanks admin of this web page.

  73. Keep it light and simple, as if you’re telling a friend a floor.
    This list could be about certain mistakes, tips, tactics, myths, etcetera.
    Submit some good work on various directories which can make sure.

  74. Great article! This is the type of info that should be shared
    across the web. Disgrace on the search engines for no longer positioning this submit upper!
    Come on over and consult with my website . Thank you =)

  75. I do believe all of the ideas you’ve introduced to your post.
    They’re very convincing and can definitely work.
    Nonetheless, the posts are very quick for starters. Could you please lengthen them a little from next
    time? Thanks for the post.

  76. Thanks for a marvelous posting! I quite enjoyed reading it,
    you might be a great author.I will make certain to bookmark your blog and may come back later in life.
    I want to encourage that you continue your great work, have a nice weekend!

  77. Hi! This is kind of off topic but I need some guidance from an established blog.
    Is it very difficult to set up your own blog? I’m not very techincal but I can figure
    things out pretty fast. I’m thinking about setting up my own but I’m not sure where to start.
    Do you have any tips or suggestions? Thanks

  78. First off I would like to say awesome blog! I had
    a quick question which I’d like to ask if you do not mind.
    I was curious to know how you center yourself and clear your thoughts before writing.
    I have had trouble clearing my mind in getting my
    thoughts out. I truly do take pleasure in writing however it just
    seems like the first 10 to 15 minutes are
    generally wasted just trying to figure out how to begin. Any suggestions or
    tips? Thank you!

  79. When I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox and from now on each time a comment
    is added I get 4 emails with the exact same comment.

    Perhaps there is a way you are able to remove me from that service?

  80. Hello, its fastidious paragraph on the topic of media
    print, we all be familiar with media is a enormous source of facts.

  81. Asking questions are in fact pleasant thing if you are
    not understanding something fully, but this article offers fastidious understanding yet.

  82. Magnificent beat ! I would like to apprentice
    while you amend your web site, how could i subscribe for a blog site?
    The account helped me a acceptable deal. I had been tiny bit acquainted of
    this your broadcast provided bright clear concept

  83. Hello, this weekend is pleasant for me, since this occasion i am reading this
    wonderful educational post here at my home.

  84. I do not know if it’s just me or if everyone else encountering problems
    with your site. It appears like some of the text on your content are running off the
    screen. Can somebody else please provide feedback and let me know if this is happening to them too?
    This could be a issue with my web browser because I’ve had this happen previously.


  85. Great site you have got here.. It’s difficult to find quality writing like
    yours nowadays. I really appreciate people like you! Take care!!

  86. Hi there! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very
    good gains. If you know of any please share. Thanks!

  87. I was curious if you ever considered changing the page
    layout of your site? Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of
    content so people could connect with it better.
    Youve got an awful lot of text for only having one or
    2 images. Maybe you could space it out better?

  88. It is perfect time to make some plans for the longer term and it’s time to be happy.
    I have learn this submit and if I may I desire to recommend you few attention-grabbing things
    or tips. Maybe you could write subsequent articles regarding this article.
    I desire to read even more issues approximately it!

  89. Because the admin of this web page is working, no hesitation very shortly
    it will be well-known, due to its quality contents.

  90. Hi! Someone in my Facebook group shared this website with us
    so I came to give it a look. I’m definitely enjoying the information. I’m book-marking and
    will be tweeting this to my followers! Fantastic blog and wonderful design and

  91. Hi there! I could have sworn I’ve been to this site
    before but after browsing through some of the post I realized
    it’s new to me. Anyways, I’m definitely glad I found it
    and I’ll be book-marking and checking back frequently!

  92. Hey there this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!


Please enter your comment!
Please enter your name here