Sunday, August 23, 2026

Mastering UFT Smart Identification

Object Identification in UFT: Mastering Smart Identification Algorithm Customization

In the world of automated testing, Unified Functional Testing (UFT) stands as a powerful tool for ensuring application quality through test automation. At the heart of UFT's effectiveness lies its sophisticated object identification mechanism, with Smart Identification serving as a crucial fallback when standard identification methods fail. Understanding how to customize this smart identification algorithm can significantly enhance your test stability and reliability.

Object Identification in UFT: Mastering Smart Identification Algorithm Customization


Understanding Object Identification in UFT

Object identification forms the foundation of UFT's test automation capabilities. When UFT interacts with an application, it first attempts to identify objects using a learned description—a collection of properties and values that uniquely define each object during the recording process. This learned description typically includes properties like the object's name, type, and other distinguishing attributes that remain consistent across test runs. However, applications often undergo changes that can affect these properties, leading to identification failures. This is where the smart identification algorithm comes into play, providing a robust mechanism to adapt to such changes while maintaining test reliability.

UFT's object identification process follows a hierarchical approach, prioritizing properties based on their uniqueness and stability. The tool first checks if all properties in the learned description match those of the runtime object. If any property differs or becomes unavailable, UFT may trigger Smart Identification—a more flexible mechanism that doesn't rely solely on the original learned properties. This dual approach ensures that tests remain resilient to minor application changes while still maintaining precision in object identification. Understanding this process is essential for creating stable, maintainable automated tests that can withstand application evolution.

The default object identification process follows a specific hierarchy, prioritizing certain properties over others. This hierarchy includes:

  • Mandatory properties (those that must match)
  • Assistive properties (used if mandatory properties don't uniquely identify an object)
  • Ordinal identifiers (used as a last resort)

UFT uses a combination of properties to identify objects, including:

  • Native properties (those inherent to the object)
  • Test object-specific properties
  • Programmatic descriptions
  • Visual relation identifiers

The learned description forms the baseline for object identification, but as applications evolve, these descriptions may become outdated, leading to test failures.

The Challenge of Dynamic Applications

Modern applications are rarely static; they evolve frequently with new features, UI redesigns, and dynamic content loading. This dynamism poses significant challenges for test automation. Objects may change their properties, new objects may appear, or existing objects might be removed. When UFT attempts to identify an object using its learned description and cannot find a match, test execution fails unless a fallback mechanism is in place.

Dynamic applications often present these challenges:

  • Changing object properties (like IDs, names, or captions)
  • Asynchronous loading of content
  • Responsive design elements that alter based on screen size
  • Data-driven interfaces where content changes while structure remains

These changes make traditional object identification methods insufficient, highlighting the need for a more flexible approach. This is where Smart Identification becomes invaluable, providing a safety net when standard object identification fails.

How Smart Identification Works

Smart Identification is UFT's intelligent fallback mechanism that activates when the tool cannot identify an object using its learned description. When standard identification fails, UFT discards the learned description and attempts to identify the object using a set of properties configured in the Smart Identification mechanism. This process involves two categories of properties:

Base Filter Properties:

  • These are mandatory properties that must match for Smart Identification to succeed
  • Typically include properties less likely to change, like class, type, or window titles
  • UFT prioritizes these properties during the identification process

Optional Properties:

  • These are additional properties that help narrow down the object if multiple candidates match the Base Filter Properties
  • Include properties that might change but are still valuable for identification
  • UFT uses these properties to distinguish between similar objects

The Smart Identification process follows a specific algorithm:

1. UFT attempts to identify the object using its learned description

2. If this fails, Smart Identification is activated (if enabled)

3. UFT searches for objects matching the Base Filter Properties

4. If multiple objects match, UFT uses Optional Properties to narrow the results

5. If a unique match is found, Smart Identification succeeds

6. If no match is found, the test fails with an object not found error

This process effectively creates a more flexible identification method that can adapt to certain changes in the application while still maintaining test reliability. The beauty of Smart Identification lies in its ability to find objects even when some properties have changed, making tests more resilient to UI modifications without requiring constant updates.

Customizing Smart Identification Algorithm

Customizing Smart Identification is essential for creating robust tests that can handle application changes. To customize Smart Identification, you need to access the Object Identification settings through the Tools menu, then navigate to the Smart Identification tab for specific object classes. Here, you can define which properties constitute Base Filter Properties and Optional Properties for different object types.

When configuring Smart Identification, consider these best practices:

  • Choose properties that are least likely to change over time
  • Include properties that uniquely identify objects within their context
  • Balance specificity and flexibility—avoid overly restrictive or vague properties
  • Regularly review and update Smart Identification configurations as applications evolve

The order of properties in both lists matters significantly, as UFT processes them in sequence when attempting to identify objects. By strategically organizing these properties—placing the most stable and distinctive ones first—you can create a robust identification mechanism that adapts to application changes while maintaining test reliability.

For example, for a web button, you might configure Base Filter Properties as "html tag" and "type", with Optional Properties including "name" and "text". This configuration would allow UFT to identify the button even if its text changes, as long as its fundamental characteristics remain consistent.

Here's a sample code snippet showing how you might programmatically configure Smart Identification properties in UFT:

' Example of configuring Smart Identification properties in UFT
' This code demonstrates how to modify Smart Identification settings for a WebButton object

' Create a description object for the WebButton
Set webButtonDesc = Description.Create()
webButtonDesc("micclass").Value = "WebButton"

' Add Base Filter Properties
webButtonDesc("html tag").Value = "INPUT"
webButtonDesc("type").Value = "submit"

' Add Optional Properties
webButtonDesc("name").Value = "submitBtn"
webButtonDesc("text").Value = "Submit"

' Use the customized description in a test
Browser("MyApplication").Page("Login").WebButton(webButtonDesc).Click

Best Practices for Effective Object Identification

Implementing effective object identification requires a strategic approach that combines proper initial configuration with ongoing maintenance. The key is to create a balance between specificity and flexibility, ensuring your tests can withstand minor application changes while maintaining accuracy.

Consider these best practices for object identification:

  • Regularly review and update object repositories to reflect current application state
  • Use descriptive, meaningful names for objects in the repository
  • Implement consistent object identification strategies across your test suite
  • Leverage Smart Identification judiciously—not as a primary identification method

When designing your object identification strategy, prioritize properties that are least likely to change. For web applications, this might include HTML tags, CSS selectors, or XPath expressions that are stable across application updates. For desktop applications, consider using object attributes like automation IDs or custom properties that are less likely to be modified during UI changes.

Another critical practice is to avoid over-reliance on dynamic properties that change frequently, such as time stamps or session IDs. While these properties might uniquely identify an object at the moment of recording, they will likely cause identification failures during subsequent test runs. Instead, focus on properties that maintain consistency across test executions while still providing sufficient differentiation between similar objects.

Regular maintenance of Smart Identification settings is also essential. As applications evolve, properties that were once stable may become unreliable, requiring updates to your Smart Identification configuration. Implementing a process to review and update these settings periodically can prevent test failures and ensure your automation suite remains effective despite application changes. Remember, the goal is to create a balance between flexibility and precision—Smart Identification should adapt to necessary changes without compromising test accuracy.

Here's an example of implementing a robust Smart Identification strategy with error handling:

' Example of implementing a robust Smart Identification strategy
' This code demonstrates how to handle objects with potentially changing properties

' Create a description object for a WebEdit with Smart Identification
Set usernameDesc = Description.Create()
usernameDesc("micclass").Value = "WebEdit"

' Configure Base Filter Properties with the most stable attributes
usernameDesc("html tag").Value = "INPUT"
usernameDesc("type").Value = "text"

' Add Optional Properties that provide additional differentiation
usernameDesc("name").Value = "username"
usernameDesc("id").Value = "user_field"

' Implement error handling for cases where Smart Identification might fail
On Error Resume Next
Browser("MyApplication").Page("Login").WebEdit(usernameDesc).Set "testuser"
If Err.Number <> 0 Then
    ' Alternative identification method if Smart Identification fails
    Browser("MyApplication").Page("Login").WebEdit("name:=username").Set "testuser"
End If
On Error GoTo 0

Troubleshooting Common Object Identification Issues

Despite careful planning, object identification issues will inevitably arise during test automation. When tests fail due to object identification problems, a systematic approach to troubleshooting is essential. Common issues include objects not being found, incorrect identification of similar objects, and performance degradation during the identification process.

One common problem occurs when the Base Filter Properties are too generic, leading to multiple potential matches and ambiguous identification. When this happens, UFT may select the wrong object, causing test failures even though Smart Identification technically succeeded. To resolve this, review your Base Filter Properties and add more distinctive criteria or adjust the order of properties to increase specificity.

Another frequent challenge involves properties that change dynamically between test runs, such as auto-generated IDs or time-based attributes. These properties can cause Smart Identification to fail consistently, as they never match the learned values. The solution involves identifying and excluding such dynamic properties from your Smart Identification configuration, focusing instead on more stable attributes that remain constant across test executions.

Performance issues can also emerge when Smart Identification processes too many properties or attempts to match against complex object hierarchies. These delays can impact test execution times and overall efficiency. To optimize performance, streamline your property lists by removing unnecessary criteria and ensuring properties are ordered from most to least distinctive.

To troubleshoot object identification problems systematically:

1. Review the test results to understand exactly where identification failed

2. Examine the object repository to verify the learned properties

3. Test the object identification manually using the Object Spy tool

4. Consider whether Smart Identification needs adjustment or if properties need updating

For persistent identification issues, you might need to implement more robust identification strategies, such as:

  • Using relative object identification techniques
  • Implementing custom object identification methods
  • Creating more specific property sets for problematic objects
  • Using dynamic property values that adapt to application changes

Advanced Techniques for Optimizing Object Identification

For experienced UFT users, several advanced techniques can further optimize object identification beyond basic Smart Identification configuration. One such approach involves implementing custom identification mechanisms using programmatic descriptions, which allow you to define objects dynamically within your test scripts rather than relying solely on the object repository. This technique provides maximum flexibility, especially when dealing with highly dynamic applications where properties change frequently.

Another advanced strategy involves creating identification "fallback hierarchies"—multiple identification methods that UFT attempts in sequence when the primary approach fails. This technique is particularly useful for applications with complex object structures or unpredictable UI changes. By defining alternative identification paths, you can create more resilient tests that adapt to various application states without manual intervention.

Regular expression patterns can also enhance Smart Identification by allowing more flexible property matching. For instance, you can use regex to match object names that follow specific naming conventions, even when the exact names vary between test runs. This approach is particularly valuable for applications that generate objects with systematic naming patterns but with variable components. By incorporating these advanced techniques, you can significantly improve the reliability and maintainability of your UFT test suites, ensuring they continue to function effectively as applications evolve.

Here's an example of implementing a fallback hierarchy for object identification:

' Example of implementing a fallback hierarchy for object identification
' This code demonstrates multiple identification methods for a dynamic element

Sub ClickDynamicElement()
    ' Method 1: Try standard identification first
    On Error Resume Next
    Browser("MyApplication").Page("Home").WebElement("id:=submit_btn").Click
    If Err.Number = 0 Then Exit Sub
    
    ' Method 2: Try Smart Identification with custom properties
    Err.Clear
    Set dynamicDesc = Description.Create()
    dynamicDesc("micclass").Value = "WebElement"
    dynamicDesc("html tag").Value = "BUTTON"
    dynamicDesc("regexpwndtitle:=Submit.*").Value = True
    Browser("MyApplication").Page("Home").WebElement(dynamicDesc).Click
    If Err.Number = 0 Then Exit Sub
    
    ' Method 3: Try identification by relative position
    Err.Clear
    Browser("MyApplication").Page("Home").WebButton("index:=3").Click
    If Err.Number = 0 Then Exit Sub
    
    ' If all methods fail, report the error
    Reporter.ReportEvent micFail, "Dynamic Element Click", "Failed to identify and click the dynamic element using all available methods."
End Sub

Conclusion

Object Identification in UFT is a critical component of successful test automation, and understanding how to customize Smart Identification can significantly improve the reliability and maintainability of your tests. By mastering the Smart Identification algorithm, you create a safety net that allows your tests to withstand application changes while maintaining accuracy. Remember that effective object identification requires both careful initial configuration and ongoing maintenance as your applications evolve.

The techniques discussed—from basic configuration to advanced optimization strategies—provide a comprehensive toolkit for enhancing your UFT test suites. As applications continue to evolve, the ability to adapt your object identification approach will remain a key differentiator in maintaining effective test automation. By investing time in understanding and customizing Smart Identification, you're not just solving immediate testing challenges but building a foundation for more robust and maintainable automation in the future.

With the right approach to object identification and Smart Identification customization, you can build robust test suites that deliver consistent results even in dynamic environments. The balance between specificity and flexibility, combined with strategic implementation of advanced techniques, will ensure your automated tests remain effective as your applications continue to change and evolve.

Frequently Asked Questions

  • What is Smart Identification in UFT?
    Smart Identification is UFT's intelligent fallback mechanism that activates when standard object identification fails. It uses Base Filter and Optional Properties to find objects even when some properties have changed.
  • How do I customize Smart Identification in UFT?
    Access Object Identification settings through the Tools menu, then navigate to the Smart Identification tab for specific object classes. Define Base Filter and Optional Properties strategically for each object type.
  • What properties should I use for Smart Identification?
    Choose properties that are least likely to change over time, like HTML tags or object types. Include properties that uniquely identify objects within their context while avoiding overly restrictive or vague properties.
  • When should I use Smart Identification?
    Smart Identification should be used as a fallback mechanism when standard identification fails, not as a primary method. It's particularly useful for applications with dynamic content or frequent UI changes.
  • How can I troubleshoot object identification issues?
    Review test results to understand where identification failed, examine the object repository, test identification manually using Object Spy, and consider adjusting Smart Identification settings or implementing fallback identification methods.

No comments:

Post a Comment