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.
Using the ODT project item and the ODT, Data, Classes editors that you can call for it, you can create a complex hierarchy of custom objects with ease. We will illustrate this with an example: suppose we are testing Microsoft Notepad using several different text files. We need to test Notepad's user interface by performing the operations available in its menu. The set of operations we will use will depend on the file loaded to Notepad. For each file to be used in our tests we will use an individual class,
ClsFile. This class will hold an array of operations. For each operation there also will be a specific class,
ClsOperation, that will determine the menu path to a given operation and 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 to the particular operation. For instance, we will use the
ClsReplaceData classes for the Find and Find and Replace operations correspondingly. In addition to all of these classes, we will create the root class,
ClsNotepadTest, that will hold references to file objects and to the main testing routine.
The custom object creation can be divided into the following steps:
4. Working With Custom Objects in Scripts