Designing Your Delphi Extensibility Code

This topic describes the objects and functions you need to develop to create support for your custom controls.

Overview

The Delphi unit that you develop for extensibility must include the following items:

  • One or more Agent Objects; one Agent Object for each type of control that you want to support. The Agent Objects interface between UFT One and the Delphi controls in the application being tested.

  • One factory function that creates the appropriate Agent Object for each control. When UFT One first interacts with a control, it calls the factory function to create the corresponding Agent Object.

For some custom controls, mapping the control to an existing Delphi test object class might provide sufficient support. In such cases, you do not have to design an Agent Object for the control.

Back to top

Creating Your Extensibility Code

To create the extensibility Delphi unit that you develop to support your custom controls, use the template unit provided with the Delphi Add-in: <UFT_One_installdir>\dat\Extensibility\Delphi\ExtensibilityImplementationTemplate.pas

In your extensibility code you must do the following:

  • Import and use the AgentExtensibilitySDK unit provided with the UFT One Delphi Add-in: <UFT_One_installdir>\dat\Extensibility\Delphi\AgentExtensibilitySDK.pas

  • Design an Agent Object for each type of control that you want to support. The Agent Object must inherit from TMicAO or one of the other Agent Object base classes defined in the Delphi Add-in Extensibility SDK. In the Agent Objects, develop published properties that support the test object methods and identification properties required for your controls. For more information, see Working with Published Properties to Support Test Object Methods and Identification Properties.

  • Create a factory function that receives an object reference of a Delphi user interface control and returns a new Agent Object. The factory function must be able to recognize the custom controls for which you are creating support, and create the appropriate Agent Object.

  • In the initialization section of your extensibility unit, call the AddExtensibilityServer API function to register your factory function to the Delphi Add-in.

For more information, see <UFT_One_installdir>\dat\Extensibility\Delphi\AgentExtensibilitySDK.pas.

Before you can run the support that you develop, you must compile the Delphi application you are testing with the extensibility unit you designed and with the Delphi Add-in precompiled agent. For more information, see Deploying the Toolkit Support Set.

Back to top

Working with Published Properties to Support Test Object Methods and Identification Properties

UFT One interacts with the application's controls by setting and retrieving the published properties provided by the Agent Object and the control itself. UFT One first accesses the published properties of the Agent Object and then, if necessary, the published properties of the Delphi object.

When you develop your Agent Object, design published properties to support the identification properties and test object methods that you defined in the test object configuration file. For example, you can create published properties in your Agent Object to enable access to (public) unpublished member variables of the control.

The following reserved properties are used for the implementation of recording and running tests and components:

  • __QTPReplayMtd_

    Use this prefix for all Agent Object properties designed to implement running UFT One test object methods.

  • __CellRect, __CellData, and __TableContent

    These properties are used to implement support for grid objects. For more information, see Creating Support for Custom Grid Controls.

  • __QTPRecording

    This property is used to implement support for the UFT One recording capability. For more information, see Supporting the UFT One Recording Capability.

The implementation for recording and running tests and components is described in the following sections:

Back to top