Preparing Delphi 7 and 2005 Applications for Testing

Applies to TestLeft 4.80, last modified on April 13, 2021

TestLeft exposes public, published, protected and private members of objects in Delphi applications if the application is compiled with debug information. This topic explains how to include debug information into applications created with Borland Delphi v. 7 or Borland Delphi 2005 for Win32.

The Delphi compiler generates debug information in the TD32 format, which is compiled into the application’s binary modules. However, it is possible to extract debug information into separate .tds files using the StripTDS utility.

TestLeft can work with both formats. However, we recommend that you create external .tds files for release builds of your products. This will decrease the overall size of your application. The TD32 format of debug information can be used for intermediate or special builds.

Below are detailed instructions on changing the project options to use the desired format of debug information.

Note: TestLeft is incompatible with tools that change the debug information format (for example, EurekaLog 7). We recommend that you disable such tools before compiling applications that will be tested with TestLeft.

Compiling Delphi Applications With External Debug Information (TDS Files)

The .tds files are created based on executables and DLLs compiled with TD32 debug information included. To remove debug information from modules and store them in separate .tds files, you can use the StripTDS utility that is shipped with TestLeft.

To create .tds files, you should first compile the tested Delphi application with debug information and then process the compiled modules with the StripTDS utility:

  1. Change the project settings to compile the application with TD32 debug information:

    • Open your project in Borland Delphi.

    • Select Project | Options from Delphi’s main menu. This will open the Project Options dialog.

    • Switch to the Compiler tabbed page and check the Debug information and Local symbols options in the Debugging group:

      Project Options: Compiler
      Note: You can keep the Local symbols disabled, but the TestLeft UI Spy will not show the names of some method parameters.
    • Switch to the Linker tab and enable the Include TD32 debug info option in the EXE and DLL options group:

      Project Options: Linker
    • Press OK to save the changes and close the Project Options dialog.

    • Re-build the application.

  2. Apply the StripTDS utility to each compiled executable and DLL. For example, to process all EXE and DLL files in the C:\MyApp folder and its subfolders, you can use the following command line:

    StripTDS.exe -r -w C:\MyApp\*.exe;C:\MyApp\*.dll

    The utility will remove debug information from the executable files and save it to separate .tds files. The utility only works with those sections in the binary file that contain debug information. It does not change the code and data sections, so your module will work as it was designed. For more information about the modifications and command-line arguments of the StripTDS utility, see About StripTDS.

Notes:

  • The .tds files containing debug information must reside in the same folders that the appropriate modules of the tested application.

  • Even if the application is compiled with the Local symbols option enabled, the names of some method parameters may not be displayed in the TestLeft UI Spy. If viewing parameter names is important to you (for instance, if you are developing new tests), compile the tested Delphi application with internal TD32 debug information (see below).

  • There is no need to distribute the generated .tds files with your application.

Compiling Delphi Applications With Internal Debug Information (TD32)

  1. Choose Project | Options from the main menu.

  2. In the ensuing Project Options dialog, switch to the Compiler tabbed page. Enable the Debug information option in the Debugging group to include debug information:

  3. To see the names of method parameters in the TestLeft UI Spy panel, turn off the Optimization option and enable the Local symbols option. When using Delphi 7.0 or later, also enable the Use Debug DCUs option:

  4. Switch to the Linker tab and enable the Include TD32 debug info option in the EXE and DLL options group:

  5. It is recommended that you turn off the Build with runtime packages option on the Packages tabbed page:

    If this property is selected, Delphi creates Borland package library (.bpl) files when compiling the application. TestLeft cannot access debug information in these files and some controls. If this property is not selected, all information is included in a single executable and can be accessed by TestLeft.

    If, for some reason, you cannot turn off the Build with runtime packages option, TestLeft may not be able to get access to the application's internal methods and properties.
  6. Once you have completed these steps, click OK to save the changes and close the Project Options dialog.

  7. Re-compile the application.

Remember to recompile the release version of your application without TD32 debug information in order to reduce the application size.

See Also

Preparing Delphi Applications for Testing

Highlight search results