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.
Description
The Enabled
property specifies whether or not the object’s method is checked in the ODT panel. It is used by the Run
methods when they walk down the object hierarchy. If Enabled
returns True, the method is executed during the walk. Otherwise, the method is ignored. For complete information on this, see Controlling Object-Driven Tests. If you set this property to True, TestComplete will reset the IsInit
property to False.
Declaration
MethodObj.Enabled
Read-Write Property | Boolean |
MethodObj | An expression, variable or parameter that specifies a reference to a Method object |
Applies To
The property is applied to the following object:
Property Value
If Enabled
is True, the Run
methods will process the method when they walk down the object hierarchy. Otherwise they will not process it.
Example
The following example creates an object based on the declared NewClass
class, obtains the method that belongs to the object and specifies that the method will be processed by the Run
method.
JavaScript, JScript
{
var NewClass, NewObj, MethodObj;
// Deletes all the existing classes and variables
ODT.Data.Clear();
ODT.Classes.Clear();
// Declares a new class
NewClass = ODT.Classes.Declare("NewClass");
// Declares a new class method
NewClass.AddMethod("NewClassMethod", "Unit1.Test1");
// Creates an object
NewObj = ODT.Classes.New("NewClass");
// Obtains the object’s method by its index
MethodObj = NewObj.Methods(0);
// Enables the method
MethodObj.Enabled = true;
…
}
VBScript
' Deletes all the existing classes and variables
ODT.Data.Clear
ODT.Classes.Clear
' Declares a new class
Set NewClass = ODT.Classes.Declare("NewClass")
' Declares a new class method
Call NewClass.AddMethod("NewClassMethod", "Unit1.Test1")
' Creates an object
Set NewObj = ODT.Classes.New("NewClass")
' Obtains the object’s method by its index
Set MethodObj = NewObj.Methods(0)
' Enables the method
MethodObj.Enabled = True
…
End Sub
DelphiScript
var NewClass, NewObj, MethodObj;
begin
// Deletes all the existing classes and variables
ODT.Data.Clear;
ODT.Classes.Clear;
// Declares a new class
NewClass := ODT.Classes.Declare('NewClass');
// Declares a new class method
NewClass.AddMethod('NewClassMethod', 'Unit1.Test1');
// Creates an object
NewObj := ODT.Classes.New('NewClass');
// Obtains the object’s method by its index
MethodObj := NewObj.Methods(0);
// Enables the method
MethodObj.Enabled := true;
…
end;
C++Script, C#Script
{
var NewClass, NewObj, MethodObj;
// Deletes all the existing classes and variables
ODT["Data"]["Clear"]();
ODT.Classes.Clear();
// Declares a new class
NewClass = ODT["Classes"]["Declare"]("NewClass");
// Declares a new class method
NewClass["AddMethod"]("NewClassMethod", "Unit1.Test1");
// Creates an object
NewObj = ODT["Classes"]["New"]("NewClass");
// Obtains the object’s method by its index
MethodObj = NewObj["Methods"](0);
// Enables the method
MethodObj["Enabled"] = true;
…
}