How to Replay a Script in QTP/UFT with Example

โšก Smart Summary

Replay a script in QTP/UFT to confirm that every recorded step still runs correctly, using Run (F5), Run from Step, Update Run Mode, and Maintenance Run Mode, then check the outcome in the Run Results Viewer.

  • ๐Ÿƒ Run (F5): Click the Run button or press F5 to execute a test from the first step in Normal run mode.
  • โญ๏ธ Run from Step: Right-click any step in the Keyword View and choose Run from Step to start execution partway through a test.
  • ๐Ÿ“ Results Folder: Pick the New Run Results Folder for a permanent RESn history, or Temporary while a script is still being fixed.
  • ๐Ÿ› ๏ธ Update Run Mode: Refresh checkpoint values, Active Screen captures, or object description properties without judging pass or fail.
  • ๐Ÿงฉ Maintenance Run Mode: Let the Maintenance Run Wizard repair the object repository interactively whenever UFT cannot find an object.
  • ๐Ÿ“Š Run Results Viewer: Review the pass, fail, and warning tree, along with checkpoint details, immediately after every run session.
  • ๐Ÿค– AI Assistance: Self-healing object identification reduces the failures that send a run into Maintenance Run Mode.

Process to Replay a Script in QTP/UFT

Once the script is recorded, you need to REPLAY the script to ensure the test steps have recorded correctly. UFT/QTP offers two ways to start that replay: click the Run button, or press the F5 shortcut, to execute the test from the first step in Normal run mode.

Besides the full Run (F5) option, UFT also supports Run from Step. Right-click any step in the Keyword View and select Run from Step to start execution at that specific step instead of the beginning. This saves time when a fix only needs re-checking partway through a long test, instead of replaying every step above it.

When you click the Run Button, a Run Dialog Box opens. The Run Box enables you to specify the location in which you want to save the run session results.

It displays the default path and folder name in which results are stored. By default results are stored in the test folder. A new sub-folder is created with the name RESn. The number n is incremented for each run. You can accept the default settings or specify a folder of your choice.

Once you click run, execution starts. In the HP QTP/UFT window you can see a yellow marker pointing at the step which is currently being executed.

As per the example shown in the below video, during Replay the script performed exactly the same 5 steps that were recorded, which signifies that there were no errors in recording. Test Results are also shown.

Click here if the video is not accessible

If a step fails during replay, UFT marks it with a red cross instead of the yellow marker, and the Run Results Viewer opens automatically at the end of the session showing exactly which checkpoint or object caused the failure.

Run Dialog Box Options in UFT/QTP

Temporary run results folder options save the results of the run in a temporary folder. This option overwrites any results previously saved in that folder. It is recommended that, while developing a test script, you choose the Temporary option, and once the script is baselined you switch to the new folder option.

Option What It Does
New Run Results Folder Creates a permanent, numbered RESn sub-folder under the test folder for every run, so the full run history stays on disk.
Temporary Run Results Folder Reuses one folder and overwrites it each run, keeping disk usage low while a script is still being fixed.
Custom Path Type or browse to any folder outside the test directory, useful when results need to sit on a shared report drive.

Choose the option that matches where the test is in its lifecycle: temporary while steps are still being fixed, permanent once the script is stable enough to keep as a baseline.

For example, a QA engineer still debugging a login script keeps results in the temporary folder to avoid filling the disk with failed attempts, then switches to the New Run Results Folder option once nightly runs on the finished script need a full audit trail for the release.

How to Change the Run Mode in UFT/QTP (Update and Maintenance Run Mode)

Update Run Mode and Maintenance Run Mode solve different problems. Update Run Mode assumes UFT still finds every object correctly and only needs stored data refreshed, while Maintenance Run Mode assumes UFT could not find an object at all and needs a live decision about how to repair the object repository.

Besides the Normal run mode used by Run (F5), the arrow next to the Run button on the toolbar exposes two more modes that change what UFT does with each step instead of simply replaying it.

Run Mode How to Start It What It Does
Run (Normal) Toolbar Run button or F5 Executes every step exactly as recorded and produces a full pass/fail run-results report.
Update Run Mode Run dropdown → Update Run Mode Refreshes stored data, such as checkpoint expected values, Active Screen captures, or object description properties, without judging pass or fail.
Maintenance Run Mode Run dropdown → Maintenance Run Mode Opens the Maintenance Run Wizard whenever UFT cannot find an object, so the object repository can be repaired while the run continues.

Follow these steps to run a test in Maintenance Run Mode:

  • Click the down arrow next to the Run button and select Maintenance Run Mode.
  • Specify the results location and any input parameter values for the session.
  • Work through the Maintenance Run Wizard each time it opens; it appears whenever an object cannot be identified, is missing from the repository, or needs Smart Identification.
  • Let the run finish; UFT opens the run results automatically once the session ends.

Maintenance Run Mode only runs when UFT/QTP is already set to Normal run mode in Tools > Options, and it requires Microsoft Script Debugger to be installed. After the wizard finishes updating a local object repository, use Update from Local Repository in the Object Repository Manager to merge those fixes back into the shared object repository the rest of the team uses.

โš  Tip: Reset the object synchronization timeout in Test Settings after a Maintenance Run Mode session. UFT does not restore this value automatically, and a wait time left high from troubleshooting can slow down every later Normal run.

The run mode can also be switched from a driver VBScript using the Automation Object Model (AOM), which is useful for scheduled or CI-triggered runs where nobody is available to click through menus:

Dim qtApp, qtResultsOpt

Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True

' Use Fast run mode for quicker execution
qtApp.Options.Run.RunMode = "Fast"

' Open the test in read-only mode
qtApp.Open "C:\Automation\Tests\LoginTest", False, False

' Point the run at a fresh results folder
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = "C:\Automation\Results\Res1"

' Run and wait for the session to finish
qtApp.Test.Run qtResultsOpt, True

MsgBox "Run finished with status: " & qtApp.Test.LastRunResults.Status

qtApp.Test.Close
qtApp.Quit

Update Run Mode and Maintenance Run Mode stay interactive by design and are started from the UFT interface rather than the AOM; the script above controls the Normal/Fast setting and triggers a standard run.

What Is the Run Results Viewer in UFT/QTP?

After every run, whether started with Run (F5), Update Run Mode, or Maintenance Run Mode, UFT opens the Run Results Viewer automatically so the outcome can be reviewed without re-running the test.

The Run Results Viewer lists every step in a tree on the left, each marked with a pass, fail, warning, or done icon, and shows details, checkpoint comparisons, and any Active Screen capture for the step currently selected. A failed step usually links straight to the property that did not match, which is faster than scanning a raw log.

Each step in the tree can be filtered to show only failed steps, which is faster than scrolling past dozens of passed actions in a long regression test. Selecting a step opens its Details pane, showing the expected and actual values side by side alongside any Active Screen thumbnail captured during the run.

In Tools > Options > GUI Testing tab > Run Sessions pane, results can be set to open as the classic Run Results Viewer window or as an extended HTML report, a setting worth changing when results need to be shared with someone who does not have UFT installed.

FAQs

F5 starts a full run from the first step in UFT/QTP. Run from Step has no default shortcut; trigger it by right-clicking the step in the Keyword View and choosing Run from Step from the context menu.

Inside a RESn sub-folder under the test folder, with n increasing for every run. The Run dialog box lets you switch to a temporary folder that gets overwritten each time, or browse to any custom path instead.

Not on its own. UFT/QTP does not retry a failed step internally, but a CI tool such as Jenkins, or ALM, can relaunch the same test through the Automation Object Model after a scheduled run reports a failure.

Increasingly, yes. AI-assisted testing tools can turn natural-language steps into VBScript and repair a script using self-healing object identification when a step fails, cutting down manual maintenance work.

Partially. Self-healing locators automatically re-identify objects that moved or were renamed, which cuts the failures that trigger the Maintenance Run Wizard. Review every automatic fix before trusting it in production.

Summarize this post with: