ODT.Data Property

Applies to TestComplete 15.63, last modified on April 23, 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.

Description

The ODT.Data property returns the Data object that provides access to data groups.

Declaration

ODT.Data

Read-Only Property The Data object

Applies To

The property is applied to the following object:

Property Value

A reference to the Data object.

Example

The following example obtains the Data object that provides access to data groups, posts the data groups’ names and the names of the variables stored in the groups to the test log.

JavaScript, JScript

function ODTSample()
{
  var Data, Group, Variable;
  // Obtains the Data object
  Data = ODT.Data;

  // Iterates through the data groups stored in the ODT project item
  for (var i = 0; i < Data.GroupCount; i++)
  {
    Group = Data.Groups(i);
    Log.AppendFolder(Group.Name);
    // Iterates through the variables stored in the current data group
    for (var j = 0; j < Group.VariableCount; j++)
    {
      Variable = Group.Variables(j);
      Log.Message(Variable.Name);
    }
    Log.PopLogFolder();
  }

}

VBScript

Sub ODTSample

  ' Obtains the Data object
  Set Data = ODT.Data

  ' Iterates through the data groups stored in the ODT project item
  For i = 0 To Data.GroupCount - 1
    Set Group = Data.Groups(i)
    Log.AppendFolder Group.Name
    ' Iterates through the variables stored in the current data group
    For j = 0 To Group.VariableCount - 1
      Set Variable = Group.Variables(j)
      Log.Message(Variable.Name)
    Next
    Log.PopLogFolder
  Next

End Sub

DelphiScript

procedure ODTSample();
var Data, Group, Variable, i ,j;
begin
  // Obtains the Data object
  Data := ODT.Data;

  // Iterates through the data groups stored in the ODT project item
  for i := 0 to Data.GroupCount - 1 do
  begin
    Group := Data.Groups[i];
    Log.AppendFolder(Group.Name);
    // Iterates through the variables stored in the current data group
    for j := 0 to Group.VariableCount - 1 do
    begin
      Variable := Group.Variables[j];
      Log.Message(Variable.Name);
    end;
    Log.PopLogFolder;
  end;

end;

C++Script, C#Script

function ODTSample()
{
  var Data, Group, Variable;
  // Obtains the Data object
  Data = ODT["Data"];

  // Iterates through the data groups stored in the ODT project item
  for (var i = 0; i < Data["GroupCount"]; i++)
  {
    Group = Data["Groups"](i);
    Log["AppendFolder"](Group["Name"]);
    // Iterates through the variables stored in the current data group
    for (var j = 0; j < Group["VariableCount"]; j++)
    {
      Variable = Group["Variables"](j);
      Log["Message"](Variable["Name"]);
    }
    Log["PopLogFolder"]();
  }

}

See Also

Data Object
Classes Property

Highlight search results