Wednesday, July 15, 2026

UFT 16 Object Identification Mastery

Mastering Object Identification in UFT 16: A Comprehensive Guide

Object identification is the cornerstone of successful test automation with Unified Functional Testing (UFT) 16, enabling the tool to recognize and interact with application elements accurately. Understanding how UFT 16 identifies and interacts with application objects is essential for creating robust, maintainable automated tests that can withstand UI changes across various application types including web, mobile, and desktop applications.




Understanding UFT 16's Object Identification Framework

Unified Functional Testing 16 employs a sophisticated object identification framework that allows it to recognize and interact with various GUI components in applications under test. When UFT 16 records or executes tests, it captures test objects that represent the actual objects in the application. These test objects are based on UFT's Test Object Model, which categorizes objects into classes like Button, Window, or List based on their characteristics.

The object identification process in UFT 16 involves several key components working together. First, UFT attempts to identify objects using a set of default properties configured in the Object Identification settings. When these properties aren't sufficient, UFT can employ additional mechanisms like ordinal identifiers or smart identification to locate objects. This multi-layered approach ensures UFT can interact with a wide variety of applications, even those with complex or dynamically changing UIs.

Key aspects of UFT 16's object identification framework include:

  • Test Object Class: The category of object (e.g., Button, EditBox)
  • Test Object Properties: Attributes used to identify objects
  • Runtime Object: The actual object in the application during test execution
  • Ordinal Identifiers: Additional properties when regular ones aren't sufficient

Understanding these fundamentals is crucial for troubleshooting identification issues and creating reliable automated tests.

The Role of Test Object Model in UFT 16

The Test Object Model (TOM) is a hierarchical representation of all objects that UFT 16 can recognize in an application. This model serves as the foundation for object identification, organizing objects into classes with associated properties and methods. When UFT interacts with an application, it maps the actual objects to their corresponding test objects in the TOM, enabling it to perform operations like clicking, typing, or selecting items.

UFT's Test Object Model distinguishes between test objects and runtime objects. Test objects exist in the test script and object repository, representing how UFT perceives objects during design time. Runtime objects, on the other hand, are the actual objects in the application during test execution. UFT uses test objects to identify and interact with runtime objects, with properties and methods acting as the bridge between these two representations.

The Test Object Model provides several benefits for test automation:

  • Consistency: Standardized way of representing objects across different applications
  • Maintainability: Changes to object properties can be managed centrally
  • Extensibility: Custom object classes can be added for specialized applications

Understanding the Test Object Model helps testers create more effective tests and troubleshoot identification issues more efficiently.

' Example of Test Object Model usage in UFT 16
' Creating a test object for a button
Set loginButton = Browser("MyApplication").Page("LoginPage").WebButton("btnLogin")

' Using the test object to interact with the runtime object
loginButton.Click
loginButton.Set "Username"

Description Properties and Their Importance

Description properties are the attributes that UFT 16 uses to uniquely identify objects in an application. These properties form the core of UFT's identification mechanism, allowing it to distinguish between similar objects and interact with the correct element. By default, UFT uses a combination of mandatory and assistive properties to identify objects, though this can be customized based on specific testing needs.

Mandatory properties are those that must match for UFT to consider an object identified. For example, for a button, the mandatory properties might include its class (e.g., "Button") and name. Assistive properties are additional properties that UFT uses if multiple objects have the same mandatory properties. The ordinal identifier, which specifies the object's position among similar objects, serves as a final fallback when properties aren't sufficient.

Configuring description properties effectively is crucial for creating robust tests. Some best practices include:

  • Using unique properties: Prioritize properties like IDs that are less likely to change
  • Limiting the number of properties: Too many properties can make identification brittle
  • Regular maintenance: Review and update properties as applications evolve

UFT's Object Identification settings allow testers to configure which properties are used for different object classes, providing flexibility based on application requirements and testing scenarios.

' Example of configuring description properties in UFT 16
' Using programmatic descriptions to identify objects
Set userNameField = Description.Create()
userNameField("micclass").Value = "WebEdit"
userNameField("name").Value = "username"
userNameField("html tag").Value = "INPUT"

' Using the description to find the object
Browser("MyApplication").Page("LoginPage").WebEdit(userNameField).Set "testuser"

Advanced Identification Techniques: Insight and VRI

Beyond traditional property-based identification, UFT 16 offers advanced techniques like Insight and Visual Recognition Identification (VRI) to handle complex or non-standard objects. Insight captures an image of the object during recording and uses this visual representation as the primary identification method. This approach is particularly useful for objects that don't have distinctive properties or whose properties change frequently.

Insight works by storing the image along with ordinal identifiers (if necessary) as part of the test object description. During test execution, UFT compares the on-screen object with the stored image to identify the correct element. This technique is especially valuable for custom controls, graphs, or other visual components where traditional property-based identification might fail (Source: Micro Focus).

Visual Recognition Identification (VRI) represents another advanced technique that extends UFT's capabilities. VRI uses pattern recognition algorithms to identify objects based on their visual characteristics rather than relying solely on properties. This approach can be particularly effective with:

  • Custom-developed applications
  • Objects with dynamic properties
  • Graphical elements or custom controls
  • Applications where traditional identification methods prove unreliable

These advanced techniques expand UFT's ability to automate testing across diverse applications and technologies, making it a more versatile testing tool.

Smart Identification and Fallback Mechanisms

Despite careful configuration, there are situations where objects cannot be identified using standard methods. UFT 16 addresses this challenge through Smart Identification, a fallback mechanism that attempts to identify objects when regular identification fails. Smart Identification uses a set of properties configured in the Smart Identification properties tab to distinguish between similar objects.

When regular object identification fails, UFT activates the Smart Identification mechanism, which filters objects based on additional properties beyond those used in regular identification. If no matching objects are found using Smart Identification, UFT employs ordinal identifiers as a last resort. This multi-tiered approach significantly increases the reliability of automated tests, especially when dealing with applications that change frequently.

The Smart Identification process follows these steps:

1. Attempts identification using mandatory and assistive properties

2. If step 1 fails, uses Smart Identification properties

3. If step 2 fails, applies ordinal identifiers

4. If all steps fail, reports an object not found error

Understanding and configuring Smart Identification is essential for creating resilient tests that can adapt to minor UI changes without constant maintenance.

' Example of handling identification failures in UFT 16
' Using OnError event handler to manage identification issues
ErrorHandler:
    ' Check if the error is related to object identification
    If Err.Number = -2147467259 Then ' Object not found error
        ' Attempt to use alternative identification method
        Set obj = Browser("MyApplication").Page("LoginPage").WebButton("micclass:=WebButton", "name:=btnLogin_alt")
        
        ' If alternative method works, continue with test
        If Not obj.Exist Then
            ' If still not found, implement recovery scenario
            Reporter.ReportEvent micFail, "Object Identification", "Failed to identify login button using all methods"
            ExitTest
        End If
    End If

Best Practices for Object Identification in UFT 16

Effective object identification requires more than just understanding UFT's capabilities—it demands a strategic approach that balances reliability with maintainability. Implementing best practices ensures that automated tests remain robust even as applications evolve, reducing maintenance overhead and increasing test effectiveness.

One fundamental practice is to use the Object Identification Center (OIC), a dedicated tool for creating unique and robust object identifications. The OIC allows testers to configure properties, ordinal identifiers, and Smart Identification settings in a centralized manner, ensuring consistency across tests. Regularly reviewing and updating object configurations is another critical practice, as applications frequently change, potentially rendering existing identifications obsolete.

Key best practices for object identification include:

  • Prioritize stable properties: Use properties less likely to change, such as unique IDs
  • Minimize dependencies on position: Avoid relying too heavily on location-based properties
  • Document identification strategies: Maintain records of why specific properties were chosen
  • Use descriptive object names: In the object repository, use names that clearly indicate the object's purpose
  • Implement regular maintenance schedules: Review and update object identifications periodically
  • Leverage the Object Repository efficiently: Organize objects logically and avoid duplication
  • Use programmatic descriptions for dynamic objects: For objects that change frequently, consider using programmatic descriptions instead of storing them in the object repository

By following these practices, testers can create automated tests that are more reliable, easier to maintain, and better equipped to handle application changes.

' Example of best practices in object identification
' Using descriptive object names in the Object Repository
' Instead of: WebButton("Button")
' Use: WebButton("LoginSubmitButton")

' Implementing regular maintenance for object identification
' Create a function to verify and update object properties
Function VerifyAndUpdateObject(objDesc, newProps)
    ' Check if object exists with current properties
    Set obj = Desktop.DesktopWindow(objDesc)
    
    If Not obj.Exist Then
        ' Object not found with current properties
        ' Try with updated properties
        updatedDesc = objDesc
        For Each prop In newProps
            updatedDesc(prop).Value = newProps(prop)
        Next
        
        Set obj = Desktop.DesktopWindow(updatedDesc)
        
        If obj.Exist Then
            ' Update object repository with new properties
            ' (Implementation depends on specific Object Repository API)
            VerifyAndUpdateObject = True
        Else
            VerifyAndUpdateObject = False
        End If
    Else
        VerifyAndUpdateObject = True
    End If
End Function

Handling Different Application Types in UFT 16

UFT 16 provides specialized object identification mechanisms for different application types, each with unique characteristics and challenges. Understanding these differences is essential for creating effective automated tests across diverse environments.

Web Applications

For web applications, UFT 16 uses the Web Add-in to identify objects based on their HTML properties, DOM structure, and CSS selectors. The tool can handle various web technologies including HTML5, Angular, React, and other modern frameworks. When working with web applications, consider these specific considerations:

  • Dynamic IDs: Many web applications generate dynamic IDs that change with each session
  • Shadow DOM: Modern web frameworks often use shadow DOM which requires special handling
  • IFrames: Objects within IFrames need to be accessed through their parent frame
  • AJAX: Applications with heavy AJAX calls require synchronization techniques

Mobile Applications

UFT 16 supports mobile application testing through the Mobile Add-in, which can identify objects in both native and hybrid mobile applications. Mobile object identification presents unique challenges:

  • Small screen sizes: Objects may be positioned differently based on device orientation
  • Touch gestures: Mobile interactions often involve complex gestures beyond simple clicks
  • Platform differences: iOS and Android use different object identification mechanisms
  • Device fragmentation: Multiple device sizes and resolutions require robust identification strategies

Desktop Applications

For traditional desktop applications, UFT 16 uses the Windows or Java Add-ins depending on the application technology. Desktop applications often have more stable object properties but can present other challenges:

  • Custom controls: Many desktop applications use custom controls that require specialized handling
  • Legacy technologies: Older applications may use technologies with limited support
  • Screen resolution: Object positions may change based on display settings
  • Multiple windows: Handling applications with multiple overlapping windows can be complex
' Example of handling different application types in UFT 16
' Web application example
Browser("MyWebApp").Page("HomePage").Link("Home").Click

' Mobile application example
Mobile("MyMobileApp").NativeButton("Login").Click

' Desktop application example
SystemUtil.Run "C:\Applications\MyDesktopApp.exe"
Window("MyDesktopApp").WinButton("OK").Click

Troubleshooting Common Object Identification Issues

Even with careful planning and implementation, object identification issues can arise in UFT 16. Being able to diagnose and resolve these issues efficiently is crucial for maintaining test automation effectiveness.

Common Identification Problems

1. Object not found errors: Occur when UFT cannot locate an object during test execution

2. Ambiguous object identification: Happens when multiple objects match the identification criteria

3. Dynamic object changes: Objects that change between recording and execution

4. Timing issues: Objects that appear or disappear based on application state

5. Technology-specific challenges: Objects in custom or unsupported technologies

Diagnostic Techniques

When faced with object identification issues, consider these diagnostic approaches:

  • Use the Object Spy: Examine the actual properties of runtime objects
  • Check the Object Repository: Verify that stored properties match the runtime objects
  • Test with programmatic descriptions: Bypass the Object Repository to isolate issues
  • Debug step by step: Execute tests one step at a time to identify where identification fails
  • Use the Test Results Viewer: Analyze detailed information about identification failures

Resolution Strategies

For common object identification issues, these strategies can help:

  • Update object properties: Modify the Object Repository with current object properties
  • Implement Smart Identification: Configure fallback identification mechanisms
  • Use ordinal identifiers: Add position-based properties when unique properties aren't available
  • Implement waits and synchronization: Add appropriate delays for objects that load dynamically
  • Use regular expressions: For properties with predictable patterns of change
  • Implement custom identification: For objects that don't work with standard methods

Conclusion

Mastering object identification in UFT 16 is essential for creating effective automated tests that can accurately interact with application elements. Understanding the Test Object Model, description properties, advanced techniques like Insight and VRI, and Smart Identification mechanisms provides a comprehensive foundation for building robust test automation.

By implementing best practices, regularly maintaining object configurations, and understanding how to handle different application types, testers can create automated tests that are more reliable, easier to maintain, and better equipped to handle application changes throughout the software development lifecycle.

As applications continue to evolve with new technologies and frameworks, UFT 16's object identification capabilities will remain a critical component of successful test automation strategies. By staying current with these capabilities and continuously refining object identification approaches, testers can ensure their automated tests remain effective in an ever-changing technological landscape.

Frequently Asked Questions

  • What is object identification in UFT 16?
    Object identification is how UFT 16 recognizes and interacts with application elements. It uses properties, ordinal identifiers, and advanced techniques like Insight to locate objects during test execution.
  • How does UFT 16's Test Object Model work?
    The Test Object Model is a hierarchical representation of objects UFT can recognize. It distinguishes between test objects (in the script) and runtime objects (in the application), with properties and methods bridging these representations.
  • What are description properties in UFT 16?
    Description properties are attributes UFT uses to uniquely identify objects. They include mandatory properties that must match and assistive properties used when multiple objects have the same mandatory properties.
  • When should I use Smart Identification in UFT 16?
    Smart Identification should be used when regular object identification fails. It's a fallback mechanism that uses additional properties to distinguish between similar objects when standard methods don't work.
  • What are best practices for object identification in UFT 16?
    Best practices include prioritizing stable properties like unique IDs, minimizing dependencies on position, documenting identification strategies, using descriptive object names, and implementing regular maintenance schedules.

No comments:

Post a Comment