Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Does SilkTest work with Delphi apps?

Does SilkTest work with Delphi apps?

SilkTest does not have native recognition of any Delphi objects. However, virtually all of the Delphi objects can be class mapped to standard SilkTest controls as is shown in the following list:-

[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

Class mapping will work in many instances, but not with every object. There are a few custom controls that do not respond to class mapping (such as TreeViews, Grids, and StaticText). However, TypeKeys() and mouse events can be used on them. Please note that GetContents() returns nothing when used on a TreeView.
SilkTest can work with Delphi objects in a number 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 app. 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 Borland 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. Borland ships the VCL source code with the product. In the VCL source, you can go to the definition of the object class that you want support for and add message handlers using the Windows API for various messages that you define.

For example, to add a message handler that does the following: if any object of this class receives a message called "SilkTest_GetValue" then get the contents of the listbox and send a message back to the originating process that contains the value.

On the SilkTest 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.

   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")

Below is an example of a message handler on the Delphi side:

   procedure QAP_GetValue (var Msg: TMessageRecord);
var
ValueToReturn : string;
begin
CopyToClipBoard;
Msg.Result := true;
end;

2. Using the Extension Kit, create a DLL that does the same thing as above, except that you make it pass 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. SilkTest low-level recording should only be used when you want to use recording rather than hand scripting.

Old KB# 23284

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:33
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.