How to Record and Playback UFT/QTP Script

โšก Smart Summary

Recording a UFT One script captures each action you perform on the application as a test step, and playing it back replays those steps against the same objects to verify the flow.

  • ๐Ÿ”˜ Identify steps first: Write the test steps down before recording, because the recorder captures whatever you do, including mistakes.
  • โ˜‘๏ธ Record and Run Settings: The dialog opens automatically the first time you record a test and then reuses the same settings.
  • โœ… Scope the session: Recording only on a specific application prevents stray steps from email or file managers reaching the script.
  • ๐Ÿงช Five recording modes: Normal, Analog, Low-level, Insight and UI Automation each suit a different kind of control.
  • ๐Ÿ› ๏ธ Objects are stored locally: Every object you touch while recording is added to the test’s local object repository.
  • ๐Ÿ“Œ Current naming: QTP is now OpenText Functional Testing (UFT One), and the Record button sits on the main toolbar.

Recording and playing back a login script in the QTP/UFT One Flight Reservation application

Before you start recording your QTP script, you need to identify the TEST STEPS that need to be automated.

There are many possible scenarios to test. In this Example, We will select a simple Test Scenario, to begin with. “Check that user successfully logs in to the application on inputting valid Agent Name & Password”

Here are the Test Steps for this Scenario

  1. Open Flight Reservation Application
  2. Enter Valid Agent Name
  3. Enter Valid Password
  4. Press Ok
  5. Close Application After Successful Login.

Let’s automate these 5 steps in OpenText Functional Testing (UFT One, formerly Micro Focus UFT and originally HP QTP). The video below runs through the whole session end to end.

Click here if the video is not accessible

Steps to Record a Script in QTP

Writing the steps down first matters more than it sounds: the recorder captures everything you do, so a wrong click becomes a step you have to delete later.

Step 1) In UFT One click the record button. The Record and Run settings Dialog Box Open. This box opens automatically each time you begin recording a new test

Step 2) Record & Run settings shows tabs corresponding to add-ins installed and loaded for your test. So, for example, if you have SAP Add-in Installed and loaded you will see an SAP tab. The Windows Application tab is always available and is used for environments, such as Visual Basic, ActiveX, and terminal emulators.

For any Environment, the Record and Run settings can be classified into two generic groups

1) Record & Run on ANY window belonging to that particular environment

2) Record & Run on a SPECIFIC window belonging to that particular environment – which is the recommended Option

For the time being, let’s stick to default settings. Once settings are done, UFT One remembers and uses the same settings for additional record sessions on the same test, unless you manually open the Record and Run Settings dialog box to modify the settings.

Step 3) Click okay. UFT One Starts Recording Mode

Step 4) Record the 5 test steps. In UFT One, Stop recording. Save the script as “LogIn”. Recording is done. More examples in the next tutorial.

While that session runs, two things happen behind the scenes. Each operation is added to the open action as a step, and each object you touch is added to the test’s local object repository with the properties UFT One will use to find it again. That is why the recorded script from these five steps reads as a plain hierarchy of Dialog, WinEdit and WinButton objects when you open it in the Expert View.

Record and Run Settings Explained

Step 2 above glosses over the dialog that causes most first-day confusion, so it is worth unpacking. The tabs you see depend entirely on which add-ins were loaded when UFT One started โ€” load none and only the Windows Applications tab appears.

Option What it does When to choose it
Record and run test on any open Windows-based application Records operations on every Windows application with a user interface that is opened during the session, however it was launched. Quick exploration, or when the application is started by another process you do not control.
Record and run only on (specific applications) Restricts the session to the applications you nominate. The recommended default. It keeps email clients and file managers out of the script and stops UFT One opening applications it does not need.

Three practical points follow from that table. If you pick the “any open application” option, close the target applications first, because for some environments UFT One can only recognise applications opened after the option is confirmed. For web testing, the browser must be opened after UFT One itself. And although the dialog appears automatically only before the first recording session on a new test, it is worth reopening it through Record > Record And Run Settings before a run, since someone may have changed the target application since the script was recorded.

UFT One Recording Modes: Normal, Analog, Low-Level and Insight

The default mode handles ordinary controls, but a signature pad or an unsupported custom grid needs something else. Switch modes from the Recording Modes dropdown on the Record toolbar, and choose Default recording mode to return to normal.

Mode What it records Use it when
Normal (default) Objects and the operations performed on them, using the test object model. Almost always. It recognises objects wherever they sit on screen.
Analog Exact mouse and keyboard movement, relative to the screen or to one window. A single RunAnalog statement calls the recorded track. Operations no object can express, such as a signature drawn with the mouse. The steps cannot be edited inside UFT One.
Low-level Parent windows as Window objects and everything else as WinObject, with a small method set such as Click, DblClick, Drag, Drop and Type. Unsupported environments where appearance may change but position will not, or where position itself matters.
Insight Objects by their appearance rather than their native properties. Controls UFT One cannot inspect at all, including a remote non-Windows desktop.
UI Automation Objects in the application as UI Automation objects. Applications exposed through the Microsoft UI Automation framework.

Analog, low-level and Insight all consume more disk space than normal recording, and low-level steps do not always replay reliably on every object โ€” treat them as targeted tools rather than defaults. A test that keeps needing them is usually a signal to write the steps with descriptive programming instead.

How to Play Back the Recorded Script

Recording only proves the steps can be captured. Playback is what proves they can be repeated.

  1. Confirm the Record and Run Settings still point at the application you want, then close the application so the first step opens it cleanly.
  2. Click Run. UFT One replays each step in order, matching every object against the properties stored in the object repository.
  3. Read the run results. A step that cannot find its object fails there, which tells you exactly which repository entry needs attention.
  4. Add checkpoints so playback verifies values rather than only completing without error.

A recorded script passes on the machine and data it was recorded with, and little else, which is the honest limitation of record and playback. Making it durable means replacing hard-coded values through parameterization, splitting the flow into reusable actions, and understanding how UFT One matches controls, covered in object identification. The full path from a recorded login to a maintainable suite is laid out across the UFT One tutorial series, and the replay walkthrough covers the run session in detail.

FAQs

It appears automatically before the first recording session on a new test, then reuses those settings. Reopen it from Record > Record And Run Settings whenever the target application changes.

Usually the add-in for that technology was not loaded at startup, or the application was already open when the “any open application” option was confirmed. For web tests the browser must be opened after UFT One.

Into the test or component’s local object repository, along with the properties UFT One will use to identify each control on playback. Shared repositories are populated separately.

Yes. The same action opens as table rows in the Keyword View or as VBScript in the Editor, and edits in either place are the same edit. Recording is a starting point, not a finished script.

Values are hard-coded, objects live in one local repository, and any interface change breaks the steps. It also captures mistakes faithfully, so a stray click becomes a step you must delete.

AI-assisted tooling can suggest replacement locators when a control changes and flag steps that fail intermittently. The suggestions still need checking against the real object properties before you accept them.

Copilot can draft VBScript functions and loops from a recorded block in any editor it supports. UFT One has no Copilot integration, so the result is pasted into the Editor and run there.

Record the first few flows to see how object hierarchy is built, then move to typed steps. Recording teaches structure quickly; writing steps teaches the reuse a real suite needs.

Summarize this post with: