Mercury.QTP.CustomServer Namespace

Use this reference together with the UFT .NET Add-in Extensibility Developer Guide. The Developer Guide contains full details on implementation, and instructions on how to configure UFT to use your Custom Server.

The following is a brief overview.

The Custom Support Server Class

The main class in a Custom Server project is your custom support server class. This class extends CustomServerBase and implements the custom replay interface.

   public class MyNetCustomSupport :
        CustomServerBase,
        IMyNetCustomSupportReplay

Implementing Recording

A Custom Server that supports recording implements the IRecord Interface by overriding the callback methods. The methods are overridden in the custom support server class.

If you support recording, define and implement the event handlers required by your test object. In your custom support server class, override InitEventListener and ReleaseEventListener to register and release your handlers. If your Custom Server runs in the UFT (QTP) context, your event listeners extend EventsListenerBase.

To listen directly to Windows messages, implement OnMessage. To get messages for objects other than the custom control, implement GetWndMessageFilter. Define and implement the message handlers required by your test object.

Implementing Test Run

The custom replay interface is marked with the ReplayInterface Attribute. Only one interface in a project can have this attribute.

Define the replay interface according to the requirements of your custom control and implement it in the custom support server class.

If you accepted the suggested name of the Test Run interface when you ran the new project wizard in Visual Studio, the name of the replay interface to be defined is the name of your Custom Server with an "I" prefix and a "Replay" suffix. For example, if your Custom Server is named abc, the Test Run interface is IabcReplay.

Running Some Methods in the AUT Context

If your Custom Server runs in the UFT (QTP) context, you can still run some code in the AUT context. To accomplish this, create assistant classes that extend CustomAssistantBase.

Table Verification

To support table verification, implement a class that extends VerificationServerBase.

Classes
 ClassDescription
ClassCustomAssistantBase The base class for objects that enable Custom Servers in the UFT context to run code in the AUT context.
ClassCustomServerBase The base class for the .NET custom support server class.
ClassEventsListenerBase The base class for objects that listen to control events in the AUT context for a Custom Server running in the UFT context.
ClassReplayInterfaceAttribute This attribute, applied to an interface, indicates that it is the Replay Interface of the custom support server class.
ClassVerificationServerBase The base class for the custom table verification server.
Interfaces
 InterfaceDescription
InterfaceIEventArgsHelper Defines the methods that must be implemented in the Event Arguments helper class of the custom server to serialize a class derived from System.EventArgs.
InterfaceIRecord Defines the methods that must be implemented to extend UFT recording.
Enumerations
 EnumerationDescription
EnumerationEventStatus Step completion statuses.
EnumerationMOUSE_BUTTON The button values for mouse related methods such as MouseClick and MouseDblClick.
EnumerationPREPARE_MASK Bit mask for the PrepareForReplay method.
EnumerationRecordingMode Options for when to write a recorded string to the script.
EnumerationRecordStatus Return values for IRecord.OnMessage.
EnumerationRunErrors Replay errors values.
EnumerationWND_MsgFilter Options for sending windows messages to the Custom Server.
Remarks

Use this reference together with the . The Developer Guide contains full details on implementation, and instructions on how to configure UFT to use your Custom Server.

The following is a brief overview.

The Custom Support Server Class

The main class in a Custom Server project is your custom support server class. This class extends CustomServerBase and implements the custom replay interface.

   public class MyNetCustomSupport :
        CustomServerBase,
        IMyNetCustomSupportReplay

Implementing Recording

A Custom Server that supports recording implements the IRecord Interface by overriding the callback methods. The methods are overridden in the custom support server class.

If you support recording, define and implement the event handlers required by your test object. In your custom support server class, override InitEventListener and ReleaseEventListener to register and release your handlers. If your Custom Server runs in the UFT (QTP) context, your event listeners extend EventsListenerBase.

To listen directly to Windows messages, implement OnMessage. To get messages for objects other than the custom control, implement GetWndMessageFilter. Define and implement the message handlers required by your test object.

Implementing Test Run

The custom replay interface is marked with the ReplayInterface Attribute. Only one interface in a project can have this attribute.

Define the replay interface according to the requirements of your custom control and implement it in the custom support server class.

If you accepted the suggested name of the Test Run interface when you ran the new project wizard in Visual Studio, the name of the replay interface to be defined is the name of your Custom Server with an "I" prefix and a "Replay" suffix. For example, if your Custom Server is named abc, the Test Run interface is IabcReplay.

Running Some Methods in the AUT Context

If your Custom Server runs in the UFT (QTP) context, you can still run some code in the AUT context. To accomplish this, create assistant classes that extend CustomAssistantBase.

Table Verification

To support table verification, implement a class that extends VerificationServerBase.

 

See Also