Object-Driven Testing

Applies to TestComplete 15.62, last modified on March 14, 2024

The Object-Driven Testing (ODT) project item provides an object-oriented way to manage complex tests that contain a lot of script routines and testing data.

Since TestComplete 10.60, the ODT project item 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 objects in scripts (see below).

Possible Alternatives

As an alternative to the ODT functionality, you can create custom classes in script code in VBScript, JScript, C#Script or C++Script projects. To learn more about this, see Language Reference. The code snippet below demonstrates how to define and use a custom class that contains a property and a routine:

JavaScript, JScript

// Define a custom class
function customClass()
{

  // Define a class property
  var classProperty;
}

// Define a class routine
customClass.prototype.classRoutine = function()
{
  // ...
}

function Test()
{
  var obj;
  
  // Create an instance of the class
  obj = new customClass();
  
  // Set the class property
  obj.classProperty = 41;
  
  // Call the class routine
  obj.classRoutine();
}

VBScript

' Define a custom class
Class customClass

  ' Define a class property
  Dim classProperty
  
  ' Define a class routine
  Sub classRoutine
    ' ...
  End Sub
End Class

Sub Test
  Dim obj
  
  ' Create an instance of the class
  Set obj = new customClass
  
  ' Set the class property
  obj.classProperty = 41
  
  ' Call the class routine
  obj.classRoutine
End Sub

C++Script, C#Script

// Define a custom class
function customClass()
{

  // Define a class property
  var classProperty;
}

// Define a class routine
customClass.prototype.classRoutine = function()
{
  // ...
}

function Test()
{
  var obj;
  
  // Create an instance of the class
  obj = new customClass();
  
  // Set the class property
  obj["classProperty"] = 41;
  
  // Call the class routine
  obj["classRoutine"]();
}

More About Object-Driven Testing

Object-Driven Testing - Basic Concepts

Explains common principles of object-driven testing.

Object-Driven Testing - Requirements

Describes what plugins are needed for TestComplete to configure and run object-driven tests.

ODT Editor

Provides information on working with the ODT editor and explains how you can modify the contents of the object-driven test.

Classes Editor

Provides information on working with the Classes editor and explains how you can declare classes and data structures for the object-driven test.

Data Editor

Provides information on working with the Data editor and explains how you can create and modify arrays and objects for the object-driven test.

Visual Creation of Custom Objects

Illustrates the process of creating custom objects visually.

Creating Custom Objects Programmatically

Illustrates the process of creating custom objects via scripts and keyword tests.

Controlling Object-Driven Tests

Describes how to use specific means for handling the object-driven tests: a) programming methods for walking down the object hierarchy and calling object methods at each level; b) means for selecting objects and methods that participate in testing.

Running Object-Driven Tests

Describes the ways you can run the object-driven test defined in the project.

See Also

ODT Object

Highlight search results