Saturday, August 22, 2026

Mastering UFT Object Identification

Mastering Object Identification in UFT: Understanding Object Properties

Object identification is the cornerstone of successful test automation in UFT (Unified Functional Testing), enabling the tool to recognize and interact with various UI elements in your applications. Understanding how UFT identifies objects through their properties is essential for creating robust, maintainable automated tests that can withstand UI changes while remaining reliable.

Mastering Object Identification in UFT: Understanding Object Properties


What is Object Identification in UFT?

Object identification refers to the process by which UFT recognizes and distinguishes different objects in your application under test. When you record a test, UFT learns the properties of objects you interact with and stores this information in the Object Repository. During test execution, UFT uses these properties to locate the same objects in the application. This "human-like" technology allows UFT to identify objects based on their characteristics rather than just their position on screen, making tests more resilient to UI changes.

Proper object identification ensures that your tests can run consistently across different environments and application versions, reducing maintenance overhead and increasing test reliability. Without a solid understanding of how object identification works, testers may struggle with flaky tests that fail with minor UI changes or fail to interact with the correct objects.

Key benefits of effective object identification:

  • Tests are more reliable and less prone to breaking
  • Reduced maintenance effort when UI changes occur
  • Better test coverage through accurate object interaction
  • Improved script readability and maintainability

UFT uses a hierarchical approach to object identification, starting with the most specific properties and expanding to more general ones if needed. This hierarchical method ensures that objects are identified accurately and efficiently, reducing the risk of false positives or failures during test execution. The object identification mechanism is what makes UFT capable of handling complex applications with numerous similar controls while maintaining test reliability.

Core components of object identification:

  • Test Object Model
  • Object Repository
  • Identification properties
  • Smart Identification mechanism

The Object Identification Process

The object identification process in UFT follows a systematic workflow to locate objects during test execution. When your test script instructs UFT to perform an action on an object, UFT first checks the Object Repository to find the corresponding object description. If a unique match is found based on the stored properties, the action proceeds successfully. If not, UFT may attempt to identify the object using alternative methods, including ordinal identifiers or Smart Identification.

This process can be visualized as a decision tree where UFT first tries to match all mandatory properties, then attempts to match assistive properties if needed, and finally falls back to ordinal identifiers or Smart Identification if the primary methods fail. Each step in this process is configurable, allowing you to fine-tune object identification behavior based on your application's characteristics.

When a test runs, UFT attempts to identify objects based on the properties stored in the Object Repository or those specified through Descriptive Programming. The process begins with UFT examining the application under test and comparing the visible objects against the test object descriptions stored in the repository or specified in the test script. UFT first tries to identify objects using their mandatory properties. If multiple objects match the mandatory properties, it then applies assistive properties to narrow down the candidates. This process continues until either a unique match is found or all available properties have been exhausted.

If UFT cannot identify an object using the standard properties, it may activate the Smart Identification mechanism, which applies additional algorithms to find the closest match. This fallback mechanism helps handle situations where objects have slightly different properties than those recorded, such as dynamically generated values or minor UI changes.

' Example of object identification in UFT using Object Repository
Browser("MyApplication").Page("LoginPage").WebEdit("username").Set "testuser"
Browser("MyApplication").Page("LoginPage").WebEdit("password").Set "testpass"
Browser("MyApplication").Page("LoginPage").WebButton("Login").Click

The identification process can be customized through the Object Identification settings, allowing testers to adjust the number and type of properties used based on their specific application needs. Proper configuration of these settings is crucial for balancing identification accuracy with performance.

Types of Object Properties

Object properties in UFT are categorized into different types that serve various purposes in the identification process. Understanding these categories helps in creating more efficient and stable tests. The primary types of properties include mandatory properties, assistive properties, and ordinal identifiers.

Mandatory properties are the essential characteristics that UFT uses to identify an object. These properties are typically unique to the object type and form the first line of identification. For example, a button might have properties like "attached text" and "type" as mandatory properties. UFT always attempts to identify objects using mandatory properties first, as this provides the most direct and reliable method.

Assistive properties come into play when mandatory properties are not sufficient to uniquely identify an object. These additional properties help distinguish between similar objects that share the same mandatory properties. The number of assistive properties used depends on the settings in the Object Identification dialog box, which can be customized based on application complexity and stability.

Ordinal identifiers are used as a last resort when both mandatory and assistive properties fail to uniquely identify an object. These include the object's location (such as index or location) in the hierarchy of objects. While ordinal identifiers can be useful, they are generally less reliable as they may change with minor UI modifications.

Common property types in UFT:

  • Mandatory properties (always used)
  • Assistive properties (used if mandatory aren't unique)
  • Ordinal identifiers (used as last resort)
  • Smart Identification properties (configured backup mechanism)

For web applications, UFT also recognizes HTML attributes as properties, allowing identification based on tag names, IDs, CSS selectors, and other web-specific attributes. This flexibility enables UFT to handle diverse applications and technologies effectively.

Property types in UFT:

  • Mandatory properties (first line of identification)
  • Assistive properties (additional distinguishing characteristics)
  • Ordinal identifiers (fallback identification methods)

Understanding how to configure and leverage these property types is essential for mastering object identification and creating resilient test automation.

Descriptive Programming

Descriptive programming is an advanced technique in UFT that allows you to bypass the Object Repository and describe objects directly in your test script using properties and values. This approach is particularly useful when dealing with dynamic objects, objects that change frequently, or when you need to identify objects that aren't stored in the Object Repository. By using descriptive programming, you can create more flexible tests that adapt to application changes without requiring constant updates to the Object Repository.

The syntax involves creating a description object with the desired properties and using it in place of a repository object reference in your test steps. Descriptive programming offers greater flexibility but requires careful management to maintain readability and avoid script complexity. It's often used in combination with Object Repository techniques to balance flexibility and maintainability in test automation frameworks.

' Example of descriptive programming in UFT
' Create a description object for a web button
Set btnDescription = Description.Create()
btnDescription("micclass").Value = "WebButton"
btnDescription("name").Value = "Submit"
btnDescription("html tag").Value = "BUTTON"

' Use the description object in a test step
Browser("MyApp").Page("LoginPage").WebButton(btnDescription).Click

Descriptive programming can also be implemented directly in test scripts without creating separate description objects, as shown in this example:

' Example of direct descriptive programming in UFT
' Instead of using Object Repository, specify properties directly
Browser("title:=Example Application").Page("title:=Home").WebEdit("name:=username", "html tag:=INPUT").Set "testuser"

Regular expressions offer a powerful way to handle objects with dynamic or partially changing properties within descriptive programming. By using special patterns in property values, testers can create more resilient object identification that accommodates variations while maintaining test stability. For example, a date field might have a value that changes daily, but its name or other properties remain consistent.

Smart Identification

Smart Identification is UFT's built-in mechanism for identifying objects when the standard identification process fails. When UFT cannot find an object using its learned description, it activates Smart Identification, which attempts to identify the object based on a set of configured fallback properties. These properties are typically more stable than the original properties and less likely to change between application versions.

Smart Identification serves as an advanced backup mechanism in object identification, designed to handle scenarios where standard identification fails. When UFT cannot identify an object using its learned properties, it activates the Smart Identification feature to attempt a match using a set of fallback algorithms.

The Smart Identification mechanism works by creating a new set of properties based on the likely characteristics of the object, rather than relying on the originally recorded properties. This process involves filtering out properties that are likely to change (like dynamic values) and focusing on those that are more stable across different runs or application states.

Smart Identification follows a two-step process: first, it filters objects based on mandatory properties, then it applies assistive properties to find the best match. If Smart Identification also fails, UFT reports an object not found error, indicating that you may need to adjust your identification settings or update your object properties.

When to use Smart Identification:

  • When objects have dynamic properties that change frequently
  • When testing applications with evolving UI
  • As a safety net for critical objects that must be found
  • When dealing with applications that don't have stable properties

You can configure Smart Identification settings in the Object Identification dialog, specifying which properties to use as fallbacks and how to prioritize them. Proper configuration of Smart Identification can significantly improve test reliability in environments where UI changes are frequent.

' Example of enabling Smart Identification in UFT
' This code would typically be part of your test initialization
SystemUtil.Run "iexplore.exe", "http://example.com"
Browser("title:=Example Application").Page("title:=Home").WebEdit("name:=username").Set "testuser"
' If the above fails, Smart Identification would attempt to find the username field
' using alternative properties and algorithms

While Smart Identification can be helpful in certain scenarios, it should be used judiciously. Over-reliance on Smart Identification can mask underlying issues with test design or object properties, potentially leading to false positives or inconsistent test results. It's generally better to optimize the standard object identification first and use Smart Identification only as a last resort.

Best Practices for Object Identification

Implementing effective object identification strategies is crucial for creating maintainable automated tests. Start by using the most stable and unique properties for object identification, avoiding those that might change frequently. Regularly review and update your Object Repository to reflect current application states, especially after UI changes.

One of the most effective practices is to use meaningful object names in the Object Repository. Instead of accepting default names like "WebEdit_1" or "WebButton_3", rename objects to reflect their function, such as "username_field" or "submit_button". This makes test scripts more readable and easier to maintain when objects need to be updated.

Another critical practice is to limit the number of properties used for identification. While it might seem helpful to include many properties to ensure uniqueness, this can make tests brittle and more likely to fail with minor UI changes. Instead, focus on using the minimal set of properties that uniquely identify an object consistently across test runs.

Tips for effective object identification:

  • Prioritize unique and stable properties
  • Regularly synchronize your Object Repository
  • Use a hybrid approach combining repository and descriptive programming
  • Document your object identification strategy for team consistency

Object identification best practices:

  • Use meaningful object names in the Object Repository
  • Limit the number of properties used for identification
  • Prioritize stable, non-volatile properties
  • Regularly review and update object properties as applications evolve

Recording techniques also play a significant role in effective object identification. When recording tests, interact with objects in ways that help UFT learn the most stable and reliable properties. For example, clicking on unique elements rather than generic ones can help UFT create more accurate object descriptions.

Proper repository management is another key aspect of best practices. Organize the Object Repository logically, using appropriate naming conventions and folder structures. This organization makes it easier to locate and maintain objects as the application evolves.

Use both Object Repository and descriptive programming techniques strategically—reserving the Object Repository for stable objects and using descriptive programming for dynamic or frequently changing elements. Implement consistent naming conventions for objects in your repository to improve readability and maintainability. Finally, test your object identification thoroughly across different environments to ensure reliability.

Advanced Object Identification Techniques

For testers looking to elevate their object identification expertise, several advanced techniques can provide greater flexibility and power in test automation. These techniques include regular expressions in properties, descriptive programming, and custom object classes.

Regular expressions offer a powerful way to handle objects with dynamic or partially changing properties. By using special patterns in property values, testers can create more resilient object identification that accommodates variations while maintaining test stability. For example, a date field might have a value that changes daily, but its name or other properties remain consistent.

Custom object classes enable testers to extend UFT's built-in recognition capabilities by teaching UFT how to identify new or custom controls. This is particularly valuable for applications that use third-party UI components or custom-developed controls that UFT doesn't recognize out of the box.

Mastering these advanced techniques allows testers to create more sophisticated and robust test automation that can handle complex scenarios while maintaining high reliability and maintainability.

Conclusion

Object identification is a fundamental concept that separates effective test automation from fragile, unreliable scripts. By understanding how UFT recognizes GUI elements, the types of properties used, and the processes involved, testers can create more stable and maintainable automated tests that withstand UI changes and application evolution.

From basic object identification principles to advanced techniques like descriptive programming and custom object classes, the knowledge of how UFT handles object recognition empowers testers to build sophisticated test automation frameworks. With proper configuration, best practices implementation, and strategic use of features like Smart Identification, testers can achieve higher test success rates and reduce maintenance overhead.

As applications continue to evolve with dynamic content and complex UI elements, mastering object identification becomes increasingly valuable. By investing time in understanding and optimizing this core capability, testers can ensure their automated tests remain effective, reliable, and adaptable to changing application landscapes.

Frequently Asked Questions

  • What is object identification in UFT?
    Object identification is the process by which UFT recognizes and distinguishes different objects in your application under test using their properties, making tests more resilient to UI changes.
  • What are the types of properties used in UFT object identification?
    UFT uses mandatory properties (essential characteristics), assistive properties (additional distinguishing features), and ordinal identifiers (location-based fallbacks) to identify objects.
  • When should I use descriptive programming in UFT?
    Descriptive programming is useful for dynamic objects, frequently changing elements, or when you need to identify objects not stored in the Object Repository, providing flexibility in test automation.
  • How does Smart Identification work in UFT?
    Smart Identification activates when standard identification fails, using configured fallback properties to find objects with dynamic or changed properties, serving as an advanced backup mechanism.
  • What are best practices for effective object identification in UFT?
    Use meaningful object names, limit the number of properties, prioritize stable properties, regularly update your Object Repository, and use a hybrid approach combining repository and descriptive programming techniques.

No comments:

Post a Comment