This topic describes the objects and functions you need to develop to create support for your custom controls.
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.
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 installation folder>\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 installation folder>\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 installation folder>\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.
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:
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.
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:
For each identification property that you want to support, make sure there is a published property with the same name in the Delphi control or the Agent Object.
Note: UFT One uses only lowercase letters in identification property names. Therefore, the names of published properties that support identification properties must contain only lowercase letters (even if the identification property name in the test object configuration file contains uppercase letters).
A UFT One user can access the published properties of the Agent Object and the Delphi control using the GetROProperty and SetROProperty methods. In addition, these published properties can be verified using checkpoints in a UFT One test and viewed in the Object Spy.
If a property name begins with a double underscore ('__'), it is not displayed in the Object Spy and cannot be accessed by checkpoints or output values. Such hidden properties can be accessed by the GetROProperty and SetROProperty test object methods, and can be accessed directly in user defined functions created in UFT One.
For each test object method that you want to support, create a published property named __QTPReplayMtd_<Test Object Method Name> in the Agent Object. For example, a published property named __QTPReplayMtd_MyTOMethod provides the implementation for running the MyTOMethod test object method.
An Agent Object must implement the __QTPRecording published property to support the UFT One recording capability.
During a recording session, when an event occurs on a custom Delphi control, UFT One sends the Windows message to the Agent Object and queries the __QTPRecording property to retrieve the corresponding line to add to the test or component.
In most cases, you do not have to implement this property in your extensibility code. If you want to create an Agent Object that supports recording, have your Agent Object inherit from the TMicRecordableAO base class.
The TMicRecordableAO agent object base class implements __QTPRecording to perform the following:
Process the parameters passed by UFT One.
Call the ProcessMessage function to determine what step to record for the event that occurred (and the recording mode).
Convert the recording information to the format required by UFT One.
In the Agent Object that you develop, you need only implement the ProcessMessage function.
When UFT One accesses the __QTPRecording property, it passes the window message parameters and window handle to the Agent Object, and expects in return, an array (of type safearray) that contains the recorded step information (the operation and its arguments) and the recording mode. For more information on recording modes, see <UFT One installation folder>\dat\Extensibility\Delphi\AgentExtensibilitySDK.pas.
Output safearray format:
Test object method to record
Test object method arguments
Note: If you create a custom test object class to support the custom control, you can use the ExtObjRecFilter attribute in the toolkit configuration file to specify the level of events that trigger recording. For more information, see Mapping Test Object Classes to Inner Objects.