Most of you probably know that Open Applications in Borland Delphi or C++Builder expose their published properties to external scripts or Connected Applications by default. But, did you know that your testing could probably benefit and be more flexible if you had external access to public elements? Well, public properties and methods can be exposed through the use of the Debug Info Agent, wrapper functions, or both.
If your application is compiled with packages, you can use both the Debug Info Agent and wrapper classes to get access to internal application methods and properties. The Agent will provide access to classes implemented in your executable. Wrapper classes will provide access to classes implemented in packages. The classes that are implemented in your executable will not expose information about public properties that were inherited from classes defined in packages, but public methods are available.
The Agent exposes the published, public, protected and private elements of an application, hence making it "open". AutomatedQA recommends that you employ the Agent to add public information to Open Applications. You can read more about this in the TestComplete 4, Using Debug Info Agent With Delphi Applications and Using Debug Info Agent With C++Builder Applications help file topics. You can access them by the help file's table of contents (Using TestCompleteTesting With TestCompleteOpen, Connected and Self-Testing ApplicationsDelphi and C++ Builder).
Since reading the debug information takes time, a delay may occur when the Agent accesses the application objects for the first time. The duration of this delay depends on the application size and it may take quite a long time if the application is large.
If you want to avoid the delay or if you do not need to have access to protected and private methods and properties, you can add public information to your Open Application using wrapper functions. Wrapper functions only provide access to published and public elements. They are defined in units that match the original source units. Wrapper functions take an object as a parameter and retrieve or set one of its public properties. Wrapper files group wrapper functions for one original unit, and also register the public methods of the source to make them accessible as published.
Wrapper files can be created by processing the original source code through TestCompletes PRegister utility. You need to do this when you want external access to public properties or methods in your own forms and units, or in third-party components.
Once you have the proper wrapper files all you need to do is add them to the uses clause of your Delphi or C++Builder project or main unit. If you add them to your project file, you can specify the "in" and the full path. Normally it will be simpler to set the path for your wrapper files in the project options. For example, Project Options | Directories/Conditionals | Search path in Delphi and Project Options | Directories/Conditionals | Library Path in C++Builder. Once this is set, you can place the wrapper files (by unit name) in your uses list.
Once you have added the wrapper files to the uses list, re-compile your Open Application and all public properties and methods in the wrapped units are externally accessible, as if they were published.