2. Creating 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.

Once we have created the classes, we can create objects based on these classes. We will start creating the object hierarchy with the topmost object based on the ClsNotepadTest class and then we will create other objects down in the hierarchy.

Creating Objects

Specifying Property Values

Working With Objects in Methods

The full code for this tutorial is available in the <TestComplete Samples>\Common\Object-Driven Testing folder. If you do not have it, download the TestComplete Samples installation package from the https://support.smartbear.com/testcomplete/downloads/samples/ page of our website and run it.

We would like to note that a custom object can only be referred to by one property, array item or a data-group variable. That is, two or more properties, array items or data-group variables referring to the same object is not allowed. For instance, if you need to exchange values of two properties that store objects, you need to assign an empty value (Nothing in VBScript, null in JScript, C++Script and C#Script and nil in DelphiScript) to one of these properties before exchanging. See 4. Working With Custom Objects in Scripts for sample code.

Prev

See Also

Creating Custom Objects Programmatically

Highlight search results