Stage 9: Implementing Support for Recording on the Book Control

By this point in the tutorial, your toolkit support set already enables full UFT One functionality. UFT One recognizes the Book control, can learn it and can run tests on it.

An additional, optional way to create tests in UFT One is by recording operations that a user performs on the application. As you can see in Plan Support for the Web Add-in Extensibility Book Sample Toolkit, by default UFT One records plain Click operations on the various Web link and image objects within the Book control. It would be more helpful to record Select, GoToAuthorPage, and GoToUsedBooksPage operations on the Book control itself, in response to those same clicks.

To support customized recording on your control, you must instruct UFT One to listen to the relevant events and inform UFT One what test steps to record in response to each event.

To do this, you write two types of JavaScript functions:

  • One JavaScript function that uses the RegisterForEvent function in the _util utility object that UFT One exposes in the Web Add-in Extensibility SDK to register for listening to the correct events on the correct elements. The arguments of this function also determine what JavaScript functions UFT One calls when each event occurs.

    You specify the name and, optionally, the location of this JavaScript function in the General tab of the test object class designer. Extensibility Accelerator saves this information in the toolkit configuration file.

  • One or more JavaScript functions that handle the events by calling the Record function in the _util utility object to inform UFT One what step to add to the test.

    Note: The Record function, and other utility object functions, require a SafeArray type argument. To convert an array to a SafeArray, you can use the toSafeArray (array) function that Web Add-in Extensibility provides. This function is defined in <Extensibility Accelerator installation folder>\bin\PackagesToLoad\common.js. (This file is also located in the <UFT One installation folder>\dat\Extensibility\Web\Toolkits folder.)

For information on the syntax of the utility object functions, see the _util section in the API Reference.

To develop support for recording on the Book control:

  1. Continue to Deploy the Support to UFT One and Test Recording.