Web Add-in Extensibility Developer Guide > Working with Web Add-in Extensibility > Developing Support for Your Toolkit > Implementing Support for Identification Properties > Customizing the Test Object Name

Customizing the Test Object Name

When UFT learns an object, it creates a unique name for each test object on the page. A descriptive test object name enables you distinguish between test objects of the same class and makes it easier to identify them in your object repository and in tests.

By default, a test object is given the name of its test object class (appended with an index if there is more than one test object of the same class on the page). In many cases, this is not the ideal name for the custom control.

The test object name needs to be meaningful to the UFT user, preferably using terminology that is relevant to your toolkit. UFT displays this name in the Keyword View, in the Editor, and in the object repository. The test object name is not used for object identification and therefore does not have to remain constant in the application.

For example, the test object name can be language-dependent. The UFT user can create a test with the application running in one language, creating test objects with names in that language. The user can then run the test on the same application in another language. The names of test objects in the test remain in the original language, but UFT can correctly recognize the test objects and perform operations on them, based on their description.

To control how UFT names test objects of a test object class, design the function that returns identification property values to return a value for the logical_name property. UFT uses this value as the test object name.

For example, WebExtBook test objects in the WebExtSample environment are named based on their book title. The sample toolkit support set for the WebExtSample environment is located in %ALLUSERSPROFILE%\Documents\ExtAccTool\Samples\WebExtSample folder. The WebExtBook.js file is defined as the default implementation file in the WebExtSample.xml toolkit configuration file. The JavaScript function for returning identification property run-time values is defined in the WebExtBook.js file as follows:

function get_property_value(prop)
{
    if ( prop == "logical_name" || prop == "title" )
    // For the "title" identification property, as well as the 
    // "logical_name" property, return the inner text of the 
    // second cell in the first row.
    {    
        return window.$(_elem.rows[0].cells[1]).text();
    }
}

Note: The $ indicates that this code uses the jQuery JavaScript function library to provide browser-independent support.