Silk Test Classic Support of Delphi Applications

This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.

While there is no support for Delphi controls "out of the box", virtually all of the Delphi objects can be class mapped to standard controls.

The following code sample shows the class mapping for the Classic Agent classes:

[ClassMap]
DialogBox,0x50000044,0x50000044=Ignore
TBitBtn=PushButton
TButton=PushButton
TCheckBox=CheckBox
TComboBox=ComboBox
TDBCheckBox=CheckBox
TDBComboBox=ComboBox
TDBEdit=TextField
TDBListBox=ListBox
TDBLookupComboBox=ComboBox
TDBLookupListBox=ListBox
TDBMemo=TextField
TDBRadioGroup=Ignore
TEdit=TextField
TFlyingPanel=Toolbar
TGroupBox=StaticText
TGroupButton=RadioButton
TListBox=ListBox
TListView=ListView
TMaskEdit=TextField
TMemo=TextField
TPageControl=PageList
TPanel=Ignore
TRadioButton=RadioButton
TRadioGroup=Ignore
TRichEdit=TextField
TRicherEdit=TextField
TScrollBar=ScrollBar
TStatusBar=StatusBar
TTabControl=PageList
TTreeView=TreeView
TUpDown=UpDown

Notes

Silk Test Classic can work with Delphi objects in a variety of ways. The amount of functionality you achieve depends on how deep you want to get involved. You can even create an extension (external) for Delphi objects. Delphi supports DLL calling, and you can use DLL's created in C/C++ in your Delphi application. Class mapping will work in many instances, but not with every object.

If class mapping doesn't work, you can try any of the following workarounds:

  1. Using SendMessage with the Clipboard.

    • Delphi is built with VCL. The VCL (Visual Component Library) is similar to MFC in that all of the classes of objects that Delphi can create are in this library. Instead of C++ it is written in Object Pascal. The VCL source code is shipped with the Delphi product. In the VCL source, you can go to the definition of the object class that you want to support for and add message handlers (windows API messages) for various messages that you define.
    • For example, add a message handler that says that if any object of this class receives a message called QAP_GetValue, get the contents of the listbox, send a message back to the process that sent the message, and send it the value. On the Silk Test Classic side of things you define a new class to support the object and add a method that sends/receives the message to the supported object.
    • For example, here is sample code of a message handler on the Delphi side:
      procedure QAP_GetValue (var Msg: TMessageRecord);
      var
      ValueToReturn : string;
      begin
      CopyToClipBoard;
      Msg.Result := true;
      end;
    • Here is sample code for the Window class on the 4Test side:
      winclass DelphObj : Control
      LIST OF STRING GetContents ()
      if (SendMessage (this.hWnd, QAP_GetListContents, NULL, NULL))
      return Clipboard.GetText ()
      else
      RaiseError (1, "Couldn't get the contents of {this},
      SendMessageEvent not processed correctly")
  2. Using the Extension Kit, create a DLL that does the same thing as above, except passing values directly from application to application rather than relying on the clipboard. This method is preferred over the above because of speed and data type stability.
  3. Use low level 4Test events relying on coordinates to create methods. Silk Test Classic low-level recording should only be used when you want to use recording rather than hand scripting.

Open Agent

To test Delphi applications with the Open Agent you could use the custom control support. For additional information, see Custom Controls (Open Agent).