Monday, August 10, 2026

Mastering UFT Object Identification

Mastering UFT Interface: Advanced Object Identification Settings and Overrides

Object identification is the cornerstone of successful automated testing with Unified Functional Testing (UFT). The ability to precisely locate and interact with application elements directly impacts the reliability and maintainability of your test automation efforts. In this comprehensive guide, we'll explore the advanced object identification settings and overrides in UFT that can help you build more robust and resilient test scripts.

Mastering UFT Interface: Advanced Object Identification Settings and Overrides



Understanding the Fundamentals of Object Identification in UFT

Unified Functional Testing (UFT) is a powerful automated testing solution that relies heavily on its ability to accurately identify and interact with application objects. The effectiveness of any UFT test script hinges on how well it can recognize these objects across different test runs, making advanced object identification settings and overrides a critical skill for any UFT professional.

Object identification in UFT refers to the process by which the tool recognizes and interacts with application elements during test execution. When you record a test, UFT captures objects based on their properties and stores them as test objects in the Object Repository. These test objects serve as representations of the actual application objects at runtime.

UFT employs a sophisticated object identification framework that distinguishes between test objects and runtime objects. Test objects are the representations of application elements stored in the object repository during the recording phase, while runtime objects are the actual elements present in the application when the test executes. This distinction is fundamental to how UFT operates. When a test runs, UFT attempts to match each test object with its corresponding runtime object using a predefined set of properties. If the default properties aren't sufficient, UFT can employ additional mechanisms like ordinal identifiers or smart identification to locate objects.

The object identification process in UFT involves several key components working together seamlessly. 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 robust test creation that can withstand minor UI changes while maintaining test reliability.

The Object Identification Center: Creating Robust Test Objects

The Object Identification Center (OIC) is a powerful tool within UFT that enables test engineers to create unique and robust identifications for application objects. This centralized interface provides comprehensive control over how UFT recognizes and interacts with various UI elements in your application. By configuring properties within the OIC, you can ensure that your tests remain stable even when applications undergo UI modifications that might otherwise break your automation scripts.

Accessing the OIC is straightforward—simply navigate to Tools > Object Identification in the UFT menu. From here, you can modify identification settings for various object classes, such as buttons, edit fields, and web elements. The OIC categorizes properties into three main groups: mandatory properties, assistive properties, and ordinal identifiers. By strategically configuring these properties, you can ensure that UFT can consistently locate objects even when their interface changes slightly.

Within the Object Identification Center, you can:

  • Modify which properties UFT uses to identify objects
  • Set priority levels for different properties
  • Configure custom properties for specialized object types
  • Export and import object identification configurations across projects

The OIC is particularly valuable when dealing with complex applications where standard identification methods may fail. By understanding and leveraging this tool, testers can create more resilient automation that adapts to application changes without requiring constant script maintenance.

' Example of working with Object Identification Center programmatically
Set objDesc = Description.Create()
objDesc("micclass").Value = "WebButton"
objDesc("html tag").Value = "INPUT"
objDesc("type").Value = "submit"

' Add custom property for identification
objDesc("customid").Value = "submitBtn"

' Use the description in your test
Browser("MyApplication").Page("HomePage").WebElement(objDesc).Click

Advanced Object Identification Settings: Mandatory and Assistive Properties

UFT's object identification system relies on two primary types of properties: mandatory and assistive properties. Mandatory properties are the essential attributes that UFT uses to uniquely identify an object. If all mandatory properties match between the test object and the runtime object, UFT considers it a successful identification. Assistive properties serve as additional criteria when mandatory properties alone aren't sufficient to distinguish between similar objects.

The Object Identification Dialog Box allows testers to configure both mandatory and assistive properties for each test object class. This configuration is crucial for handling applications with dynamically generated elements or those that lack stable identifiers. By carefully selecting and prioritizing these properties, test engineers can create more reliable automation that withstands minor UI changes.

When configuring properties, consider these best practices:

  • Choose properties that are least likely to change between test runs
  • Include enough properties to uniquely identify objects without being overly restrictive
  • Balance between using native properties and adding custom ones
  • Regularly review and update property configurations as applications evolve

The default object identification mechanism works by using a combination of properties that uniquely identify each object. However, in complex applications with dynamically changing elements, the default settings may not always suffice. This is where advanced identification settings become crucial. By understanding how UFT identifies objects, you can troubleshoot flaky tests and create more reliable automation frameworks. The key is to find the right balance between flexibility and specificity in your object identification strategy.

Ordinal Identifiers and Smart Identification Mechanisms

When standard properties aren't sufficient to identify objects, UFT employs two additional mechanisms: ordinal identifiers and smart identification. Ordinal identifiers determine an object's position relative to other objects in the hierarchy, using methods such as location, index, or creation time. These are particularly useful when dealing with objects that share identical properties but appear in different positions on the screen.

Smart identification is UFT's fallback mechanism when both mandatory and assistive properties fail to uniquely identify an object. This advanced feature filters objects based on a set of "filter" properties and then applies "scored" properties to determine the best match. The smart identification mechanism can be enabled or disabled for each test object class through the Object Identification settings, providing fine-grained control over how UFT handles uncertain identifications.

Smart identification is a more sophisticated fallback mechanism that activates when standard identification fails. It uses a set of filter properties and base filters to create a more flexible matching algorithm. Smart identification attempts to identify objects by:

1. Eliminating objects that don't match the filter properties

2. From the remaining objects, selecting one that matches the most base filter properties

3. If multiple objects match, selecting the one with the highest ordinal identifier

While smart identification can be helpful in certain scenarios, it should be used judiciously as it can sometimes lead to inconsistent results. Disabling smart identification for objects that can be reliably identified through other methods is often a better approach.

Implementing smart identification effectively requires understanding:

  • Which properties work best as filters versus scored properties
  • When to enable smart identification versus relying on manual configuration
  • How to troubleshoot when smart identification produces incorrect matches
  • Balancing between smart identification and maintaining test performance
' Example of overriding object identification settings programmatically
' Set the smart identification properties for a specific object class
Set objClassDescription = Description.Create()
objClassDescription("micclass").Value = "WebEdit"

' Configure smart identification for WebEdit objects
SmartIdentificationProperties.FilterProperties.Add "name", ".*"
SmartIdentificationProperties.ScoredProperties.Add "id", 30
SmartIdentificationProperties.ScoredProperties.Add "type", 20
SmartIdentificationProperties.ScoredProperties.Add "location", 10

' Apply the configuration to the object class
Set objClass = ObjectRepository.ObjectDescriptions("WebEdit")
objClass.SetSmartIdentificationProperties SmartIdentificationProperties

' Use the customized object identification in your test
Browser("MyApplication").Page("HomePage").WebEdit("username").Set "testuser"

Object Identification Overrides for Custom Scenarios

While UFT provides robust default object identification capabilities, there are scenarios where these defaults need to be overridden. Test engineers can modify identification settings at multiple levels—from global settings specific to entire test object classes to individual object overrides in the repository. This flexibility allows for customized identification strategies tailored to specific application requirements.

Object identification overrides can be implemented at several levels:

  • At the test object level within the Object Repository
  • Programmatically within your test scripts using the SetTOProperty method
  • Through descriptive programming that bypasses the Object Repository entirely

Overriding default settings is particularly valuable when dealing with:

  • Custom controls that don't conform to standard object patterns
  • Applications with frequently changing UI elements
  • Legacy applications with inconsistent object properties
  • Testing environments where objects behave differently than during recording

For example, when working with web applications that generate elements with dynamic IDs, you might need to implement custom identification logic:

' Example of setting a custom property for dynamic object identification
Set editBox = Browser("MyApp").Page("HomePage").WebEdit("username")
editBox.SetTOProperty("html id", "username_field_" & SessionID)

Another common scenario is when dealing with objects that change their properties during runtime:

' Example of using regular expressions for dynamic object identification
Set button = Browser("MyApp").Page("HomePage").WebButton("btn_.*")
button.Click

To implement effective overrides:

  • Document all custom identification configurations
  • Use version control for object repository modifications
  • Regularly validate that overrides continue to work as applications evolve
  • Create naming conventions for overridden objects to maintain clarity

Best Practices for Object Identification in Complex Applications

Implementing effective object identification strategies requires careful planning and adherence to best practices. When working with complex applications, consider the following guidelines:

1. Minimize the use of ordinal identifiers: While convenient, ordinal identifiers can make tests brittle when UI layout changes. Reserve them for scenarios where no other unique identification is possible.

2. Regularly review and update object properties: As applications evolve, so should your object identification strategies. Schedule periodic reviews of your Object Repository to ensure properties remain relevant and stable.

3. Leverage object repositories effectively: Use shared object repositories for common objects and local repositories for test-specific objects to maintain a balance between reusability and specificity.

4. Implement consistent naming conventions: Develop a standardized approach for naming objects in your Object Repository to improve clarity and maintainability.

5. Document complex identification strategies: When using advanced identification techniques, document your approach to ensure knowledge transfer and easier maintenance.

Mastering advanced object identification requires adopting several best practices that ensure your tests remain maintainable and reliable across different test cycles. First, establish a consistent strategy for property selection that balances uniqueness with stability. Properties that are too specific may break with minor UI changes, while those too general might lead to incorrect object identification.

Regular maintenance of object identification settings is another critical practice. As applications evolve, properties that once provided stable identification may become unreliable. Schedule periodic reviews of your object repositories and identification configurations to adapt to these changes while maintaining test integrity.

Key considerations for maintaining robust object identification include:

  • Implementing a hierarchical approach to property configuration
  • Creating documentation for custom identification strategies
  • Using parameterization for properties likely to change between environments
  • Leveraging programming interfaces for complex identification scenarios
  • Training team members on advanced identification techniques
' Example of implementing custom identification logic
Function FindObjectByCustomLogic(browserName, pageName, objType, customProp)
    ' Create a description with the specified object type
    Set objDesc = Description.Create()
    objDesc("micclass").Value = objType
    
    ' Add the custom property for identification
    objDesc("customid").Value = customProp
    
    ' Attempt to find the object using the custom description
    On Error Resume Next
    Set foundObject = Browser(browserName).Page(pageName).ChildObjects(objDesc)
    
    ' Check if any objects were found
    If foundObject.Count > 0 Then
        Set FindObjectByCustomLogic = foundObject(0)
    Else
        Set FindObjectByCustomLogic = Nothing
    End If
    
    On Error GoTo 0
End Function

' Usage example:
Set loginButton = FindObjectByCustomLogic("MyApplication", "HomePage", "WebButton", "loginSubmit")
If Not loginButton Is Nothing Then
    loginButton.Click
Else
    Reporter.ReportEvent micFail, "Login Button", "Could not find login button with custom identifier"
End If

Conclusion

Mastering UFT's advanced object identification settings and overrides is essential for creating reliable and maintainable automated tests. By understanding the intricacies of how UFT identifies objects, leveraging the Object Identification Center, implementing strategic property configurations, and utilizing identification overrides when necessary, you can build test automation that is both resilient to changes and efficient in execution.

As applications continue to evolve and become more complex, the importance of sophisticated object identification techniques only grows. Investing time in understanding and implementing these advanced capabilities will pay dividends in the form of more stable test suites, reduced maintenance overhead, and faster feedback cycles throughout the software development lifecycle.

Understanding and implementing advanced object identification settings and overrides is essential for creating reliable and maintainable UFT test automation. By mastering the Object Identification Center, configuring mandatory and assistive properties effectively, leveraging ordinal identifiers and smart identification, and knowing when to override default settings, test engineers can significantly improve the stability and resilience of their automation efforts. These advanced techniques ensure that your UFT tests continue to function accurately even as applications undergo changes, ultimately saving time and resources in the long run.

Frequently Asked Questions

  • What is object identification in UFT?
    Object identification in UFT refers to the process by which the tool recognizes and interacts with application elements during test execution. It distinguishes between test objects stored in the Object Repository and runtime objects present during execution.
  • How does the Object Identification Center work?
    The Object Identification Center is a tool in UFT that allows test engineers to create unique and robust identifications for application objects. It provides control over mandatory properties, assistive properties, and ordinal identifiers for various object classes.
  • When should I use smart identification in UFT?
    Smart identification should be used as a fallback mechanism when standard properties fail to uniquely identify objects. It filters objects based on 'filter' properties and applies 'scored' properties to determine the best match, but should be used judiciously as it can sometimes lead to inconsistent results.
  • How can I override object identification settings in UFT?
    Object identification overrides can be implemented at multiple levels - at the test object level within the Object Repository, programmatically using the SetTOProperty method, or through descriptive programming that bypasses the Object Repository entirely.
  • What are best practices for object identification in complex applications?
    Best practices include minimizing the use of ordinal identifiers, regularly reviewing and updating object properties, leveraging object repositories effectively, implementing consistent naming conventions, and documenting complex identification strategies for maintainability.

No comments:

Post a Comment