Customizing the Test Object Name

When UFT One 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 One user, preferably using terminology that is relevant to your toolkit. UFT One 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 One 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 One can correctly recognize the test objects and perform operations on them, based on their description.

To control how UFT One 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 One 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._uft.$(_elem.rows[0].cells[1]).text();
    }
}

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

UFT 14.50 and earlier

If your toolkit was developed using a UFT version of 14.50 or earlier, the jQuery library is called using only $.

If errors occur due to conflicting jQuery libraries, we recommend you upgrade your toolkit using UFT 14.51 or later.