What Is the Role of the Object Repository in UFT, and How Do You Manage It Effectively?
Introduction
Imagine running a UFT test where buttons click themselves, fields auto-populate, and workflows complete without a single glitch. Now imagine the opposite scripts failing because the tool cannot identify a login button or textbox that exists right on the screen.
This single difference defines the power of the Object Repository in UFT. Whether you work with quicktest professional, hp qtp, or the modern unified functional testing suite, the Object Repository acts as the backbone of reliable qtp testing.
In real-world automation projects, organizations use UFT to test enterprise applications such as Oracle, SAP, Siebel, banking systems, telecom platforms, healthcare portals, and large ERP systems. In these environments, object recognition failures can cost hours of testing time, delay releases, and increase defect leakage.
This is why learning how the Object Repository works and how to manage it like a pro is one of the most important skills in HP UFT Real-Time Project-Based Training.
This blog explains everything you need to know, from the fundamentals to hands-on examples, best practices, and real use cases.
Understanding the Object Repository in UFT
What Is an Object Repository?
In quicktest professional (QTP) and unified functional testing (UFT), the Object Repository (OR) is the storage area where UFT keeps information about UI elements (objects) it interacts with during automation.
When UFT identifies a button, link, textbox, grid, or dropdown, it stores the following details:
-
Object name
-
Class (Button, WebEdit, WinButton, SAPGuiButton, etc.)
-
Properties (name, html id, class, XPath, index, text, etc.)
-
Values of the properties
-
Optional description criteria
The automation script uses these stored details to interact with the object reliably.
In simple terms:
Object Repository is the dictionary UFT uses to “remember” objects in the application.
If the OR is accurate, your tests run smoothly.
If it is not, your tests fail no matter how well you write the script.
Why UFT Needs an Object Repository
Automation tools must identify UI elements with absolute accuracy. UFT does this through OR entries.
Without an Object Repository:
-
UFT cannot click a button
-
UFT cannot enter text in a field
-
UFT cannot choose menu items
-
UFT cannot verify object values
-
UFT cannot perform navigation
Every action in UFT scripted or recorded requires object identification.
Real-World Example:
During a banking login automation test, UFT must identify:
-
Username field
-
Password field
-
Login button
-
Error message
-
Profile navigation menu
If even one object is missing or incorrectly defined, the test fails.
Types of Object Repositories in UFT
UFT supports two types of ORs:
1. Shared Object Repository (SOR / TSR file)
-
Saved as .tsr or .bdb
-
Reusable across multiple test scripts
-
Managed centrally
-
Ideal for enterprise applications
Example:
A project with 500 UFT test cases uses a single Shared Object Repository.
When one object changes, you update it once and all tests benefit.
2. Local Object Repository (LOR)
-
Exists inside each test script
-
Used for quick or temporary automation
-
Not reusable by other scripts
-
Difficult to maintain at scale
Example:
A small proof-of-concept test or one-time automation workflow.
Which One Should You Choose?
|
Feature |
Shared OR |
Local OR |
|
Reusability |
High |
Low |
|
Maintenance |
Easy |
Difficult |
|
Scalability |
Excellent |
Limited |
|
Recommended For |
Enterprise projects |
Small scripts |
Real-world teams prefer Shared OR because it improves test stability.
How the Object Repository Works Internally
How UFT Learns Objects
When you use the Object Spy or record actions, UFT:
-
Reads object properties
-
Selects mandatory properties
-
Adds assistive properties
-
Generates the unique description
-
Stores it in the OR
Example (Login Button):
-
Class: WebButton
-
Name: Login
-
HTML ID: btnLogin
-
Type: submit
-
Index: 0
UFT compares these properties with other objects to ensure uniqueness.
Mandatory and Assistive Properties
UFT uses two types of properties:
Mandatory Properties
Predefined essential properties for object identification.
Examples:
-
Browser: name
-
WebEdit: html tag
-
WebButton: type
Assistive Properties
Used only when mandatory properties are not unique.
Examples:
-
index
-
inner text
-
title
-
HTML ID
Ordinal Identifiers
UFT uses ordinal identifiers when properties are insufficient:
-
Index (0,1,2…)
-
Location (top-left order)
-
CreationTime (browser instance order)
Good OR management reduces the need for ordinal identifiers.
How to Create, View, and Update Object Repositories
Adding Objects Using Object Spy (Recommended)
Object Spy allows you to capture objects one by one.
Steps:
-
Open UFT
-
Click Object Spy
-
Hover over the object
-
Add to local or shared OR
-
Rename object for clarity
Example:
Browser("BankSite").Page("Login")...
Rename objects using standards such as:
-
btnLogin
-
txtUsername
-
ddlAccountType
-
lnkProfile
Consistent naming improves script readability.
Adding Objects Through Recording
When you record your test, UFT automatically adds objects to the OR.
But recording:
-
Creates duplicates
-
Adds unnecessary objects
-
Reduces OR readability
Best practice:
Use recording only for quick capture, then clean the OR manually.
Updating Objects After UI Changes
When an application UI changes:
-
Button label may change
-
HTML ID may change
-
Position may change
-
Controls may be replaced (e.g., Angular upgrade)
This leads to object recognition errors.
To fix:
-
Use Object Spy
-
Compare new properties
-
Update values inside OR
-
Test object with Highlight in Application
Managing Object Repositories Effectively
This is the most important section because real-world testers face OR challenges daily.
Use Shared Object Repositories in All Enterprise Projects
Shared OR:
-
Improves reuse
-
Avoids reconstruction
-
Keeps scripts light
-
Reduces duplication
Example folder structure:
/UFT_Project
/Shared_OR
Login.tsr
Dashboard.tsr
Search.tsr
Profile.tsr
/Tests
/Function_Library
Create Modular ORs Based on Application Modules
Avoid building a massive 10,000-object repository.
Instead, divide based on the application’s functional areas.
Example for Telecom Application:
-
CustomerManagement.tsr
-
Billing.tsr
-
Recharge.tsr
-
Reports.tsr
-
Login.tsr
Benefits:
-
Faster load time
-
Easier debugging
-
Better version control
Naming Conventions for Object Repository
Use prefixes and abbreviations for clarity.
|
Type |
Prefix |
Example |
|
Button |
btn |
btnSubmit |
|
Textbox |
txt |
txtSearch |
|
Dropdown |
ddl |
ddlUserType |
|
Link |
lnk |
lnkLogout |
|
Checkbox |
chk |
chkSelectAll |
This improves script readability across teams.
Manage Object Repository with Object Repository Manager (ORM)
The ORM allows you to:
-
Merge ORs
-
Remove duplicates
-
Rename objects
-
Edit properties
-
Associate ORs with multiple tests
-
Perform bulk updates
Example Workflow:
-
Open ORM
-
Load Login.tsr and Dashboard.tsr
-
Merge into MainModule.tsr
-
Save and replace older versions
Associate Object Repository with Test Scripts
Each test requires linked Shared OR files.
Steps:
-
Open Test > Resources
-
Add Shared Repository
-
Arrange repository order
Example:
1. Login.tsr
2. Dashboard.tsr
3. Reports.tsr
Order matters because UFT searches from top to bottom.
Descriptive Programming vs Object Repository
When Object Repository Is Not Needed
Sometimes dynamic objects change frequently.
Example:
-
Dynamic IDs
-
Random element indexes
-
AJAX controls
-
Angular/React components
In these cases, especially when working with rapidly changing UI layers during qtp testing, descriptive programming helps.
Example Code:
Browser("Bank").Page("Dashboard").WebButton("text:=Add Account","type:=button").Click
But don’t overuse descriptive programming.
Best Practice: Mix Object Repository + Descriptive Programming
Use OR for:
-
Stable login fields
-
Menu navigation
-
Standard pages
Use DP for:
-
Dynamic tables
-
Repeating controls
-
Custom frameworks
This hybrid model balances stability and flexibility.
Common Mistakes in Object Repository Management
Allowing Duplicate Objects
Duplicate objects slow down execution.
Fix using ORM’s merge and clean tools.
Storing Unnecessary Objects
Recording often adds:
-
Hidden fields
-
Debug controls
-
Temporary popups
Identify and delete them.
Using Local OR in Large Projects
Avoid using local ORs because:
-
They create redundancy
-
Every change requires updating multiple tests
-
Version control becomes complex
Use Shared OR instead.
Using Index and Location Properties Excessively
Index-based recognition breaks easily.
Example:
WebButton("index:=2")
Avoid unless there is no alternative.
Advanced Object Repository Strategies
Use Regular Expressions in OR
Useful for dynamic values.
Example for username label:
text := “Welcome.*”
Use Smart Identification
Smart Identification helps when object properties change.
Components:
-
BaseFilter properties
-
OptionalFilter properties
Use with caution because it may mask OR issues.
Implement OR Version Control
Teams use:
-
Git
-
SVN
-
TFS
Best practices:
-
One OR per module
-
Lock files during editing
-
Maintain release-wise OR snapshots
Real-World Case Studies
Case Study 1: Banking Application Login Failure
A major bank used UFT for regression testing.
After every UI update, 40% of login scripts failed.
Root Cause:
Incorrect OR properties due to UI upgrade.
Solution:
-
Updated mandatory properties
-
Removed dynamic properties
-
Redesigned Shared OR
Failures dropped from 40% to under 2%.
Case Study 2: Telecom Billing System Regression Suite
500+ test cases depended on a single Shared OR.
Problems:
-
Slow execution
-
Frequent failures
-
Difficult debugging
Team restructured OR modules:
-
Billing
-
CRM
-
Payments
-
Reports
Result:
Regression time reduced from 14 hours to 8 hours.
Case Study 3: Healthcare Portal Dynamic Table Handling
OR struggled to identify dynamic rows.
Solution:
-
Used descriptive programming for tables
-
Kept other objects in Shared OR
Stability improved significantly.
Hands-On Example – Creating and Managing Object Repository
Below is a simple hands-on guide.
Step-by-Step Tutorial
Step 1: Launch UFT and Open a Test
File > New > Test
Step 2: Open Object Repository Manager
Resources > Object Repository Manager
Step 3: Use Object Spy to Capture Objects
Click the Spy icon
Hover over the Login page controls
Add them to OR
Step 4: Rename Objects Using Standards
Example:
-
txtUsername
-
txtPassword
-
btnLogin
Step 5: Save Shared OR
File > Save As > Login.tsr
Step 6: Associate OR with Test
Resources > Associate Repositories
Add Login.tsr.
Sample VBScript Code using the OR
Browser("BankSite").Page("Login").WebEdit("txtUsername").Set "admin"
Browser("BankSite").Page("Login").WebEdit("txtPassword").Set "Admin123"
Browser("BankSite").Page("Login").WebButton("btnLogin").Click
Conclusion
Mastering Object Repository management is the key to building stable, scalable, and reliable UFT automation. Start practicing these techniques today to strengthen your automation skills and grow confidently in your UFT career. When you understand how object handling works in uft software testing, you reduce test failures, improve script maintenance, and build automation frameworks that adapt easily to UI changes. This expertise not only boosts your efficiency but also positions you as a valuable automation professional in any real-time project environment.
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Games
- Gardening
- Health
- Home
- Literature
- Music
- Networking
- Other
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness