Variable Object

Applies to TestComplete 14.70, last modified on April 22, 2021

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 Variable objects provide a scripting interface to the variables that were created in data groups via the ODT editor.

To obtain the Variable object in scripts, use the Variables property of the Group object.

Members

Example

The following example demonstrates how to obtain the Variable object in script:

JavaScript, JScript

function Test()
{
  var Group;
  …

  // Obtains the ODT group
  Group = ODT.Data.Groups("MyGroup");
  // Sets a new value to the MyVar variable
  Group.Variables("MyVar").Value = "New Value";

  …

}

VBScript

Sub Test
  Dim Group
  …

  ' Obtains the ODT group
  Set Group = ODT.Data.Groups("MyGroup")
  ' Sets a new value to the MyVar variable
  Group.Variables("MyVar").Value = "New Value"

  …

End Sub

DelphiScript

procedure Test();
var Group;
begin
  …

  // Obtains the ODT group
  Group := ODT.Data.Groups('MyGroup');
  // Sets a new value to the MyVar variable
  Group.Variables('MyVar').Value := 'New Value';

  …

end;

C++Script, C#Script

function Test()
{
  var Group;
  …

  // Obtains the ODT group
  Group = ODT["Data"]["Groups"]("MyGroup");
  // Sets a new value to the MyVar variable
  Group["Variables"]("MyVar")["Value"] = "New Value";

  …

}

See Also

Group Object
Variables Property

Highlight search results