Creating Custom Objects Programmatically

Applies to TestComplete 15.69, last modified on November 13, 2024

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

The ODT project item allows you to create custom objects both visually (via the ODT, Classes and Data editors) and programmatically (using ODT program objects). For information on how to create objects via these editors, see Visual Creation of Custom Objects.

This topic explains how to create custom objects programmatically. We will illustrate this with an example.

Suppose that we are testing Microsoft Notepad using several different text files. We need to test Notepad's user interface by performing the operations available via its menu. The set of operations we use depends on the file loaded in Notepad. For each file to be used in our tests we will use an individual class, ClsFile. This class will hold the array of operations. For each operation there will be a specific class, ClsOperation, which will determine the menu path to a given operation and the list of testing data to be used for the chosen operation. Each set of testing data can also be represented by an object of a class specific for the particular operation. For instance, we will use the ClsFindData and ClsReplaceData classes for the Find and Find and Replace operations. In addition to all of these classes, we will create the root class, ClsNotepadTest, that will hold references to the file objects and the main testing routine.

See Also

ODT Project Item
Visual Creation of Custom Objects

Highlight search results