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 ODT.Classes
property returns the Classes
object that holds a collection of classes created via the ODT project item.
Declaration
Applies To
The property is applied to the following object:
Property Value
A reference to the Classes
object.
Example
The following example obtains the collection of classes the ODT project item stores, iterates through the classes and posts their names to the test log:
JavaScript, JScript
function ODTSample()
{
var Classes, ODTClass;
// Obtains the collection of classes
Classes = ODT.Classes;
// Posts the names of the classes to the test log
if (Classes.Count > 0)
{
Log.AppendFolder("The ODT project item contains the following classes:");
for (var i = 0; i < Classes.Count; i++)
{
ODTClass = ODT.Classes.Items(i);
Log.Message(ODTClass.Name);
}
Log.PopLogFolder();
}
}
{
var Classes, ODTClass;
// Obtains the collection of classes
Classes = ODT.Classes;
// Posts the names of the classes to the test log
if (Classes.Count > 0)
{
Log.AppendFolder("The ODT project item contains the following classes:");
for (var i = 0; i < Classes.Count; i++)
{
ODTClass = ODT.Classes.Items(i);
Log.Message(ODTClass.Name);
}
Log.PopLogFolder();
}
}
VBScript
Sub ODTSample
' Obtains the collection of classes
Set Classes = ODT.Classes
' Posts the names of the classes to the test log
If Classes.Count > 0 Then
Log.AppendFolder "The ODT project item contains the following classes:"
For i = 0 To Classes.Count - 1
Set ODTClass = ODT.Classes.Items(i)
Log.Message ODTClass.Name
Next
Log.PopLogFolder
End If
End Sub
' Obtains the collection of classes
Set Classes = ODT.Classes
' Posts the names of the classes to the test log
If Classes.Count > 0 Then
Log.AppendFolder "The ODT project item contains the following classes:"
For i = 0 To Classes.Count - 1
Set ODTClass = ODT.Classes.Items(i)
Log.Message ODTClass.Name
Next
Log.PopLogFolder
End If
End Sub
DelphiScript
procedure ODTSample();
var Classes, ODTClass, i;
begin
// Obtains the collection of classes
Classes := ODT.Classes;
// Posts the names of the classes to the test log
if Classes.Count > 0 then
begin
Log.AppendFolder('The ODT project item contains the following classes:');
for i := 0 to Classes.Count - 1 do
begin
ODTClass := ODT.Classes.Items[i];
Log.Message(ODTClass.Name);
end;
Log.PopLogFolder;
end;
end;
var Classes, ODTClass, i;
begin
// Obtains the collection of classes
Classes := ODT.Classes;
// Posts the names of the classes to the test log
if Classes.Count > 0 then
begin
Log.AppendFolder('The ODT project item contains the following classes:');
for i := 0 to Classes.Count - 1 do
begin
ODTClass := ODT.Classes.Items[i];
Log.Message(ODTClass.Name);
end;
Log.PopLogFolder;
end;
end;
C++Script, C#Script
function ODTSample()
{
var Classes, ODTClass;
// Obtains the collection of classes
Classes = ODT["Classes"];
// Posts the names of the classes to the test log
if (Classes["Count"] > 0)
{
Log["AppendFolder"]("The ODT project item contains the following classes:");
for (var i = 0; i < Classes["Count"]; i++)
{
ODTClass = ODT["Classes"]["Items"](i);
Log["Message"](ODTClass["Name"]);
}
Log["PopLogFolder"]();
}
}
{
var Classes, ODTClass;
// Obtains the collection of classes
Classes = ODT["Classes"];
// Posts the names of the classes to the test log
if (Classes["Count"] > 0)
{
Log["AppendFolder"]("The ODT project item contains the following classes:");
for (var i = 0; i < Classes["Count"]; i++)
{
ODTClass = ODT["Classes"]["Items"](i);
Log["Message"](ODTClass["Name"]);
}
Log["PopLogFolder"]();
}
}