AddGroup Method

Applies to TestComplete 15.20, last modified on January 19, 2022

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 Data.AddGroup method creates a new data group with the specified name and returns this group as a Group object.

Declaration

DataObj.AddGroup(Name)

DataObj An expression, variable or parameter that specifies a reference to a Data object
Name [in]    Required    String    
Result A Group object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Name

Specifies the name of the new group. The group name must be unique. If there is another data group with the specified name, an error occurs.

Result Value

The new group represented as a Group object.

Example

The code below creates a new data group and adds new variables to it.

JavaScript, JScript

function AddGroupExample()
{
  // Creates a new data group
  var Group = ODT.Data.AddGroup("NewDataGroup");
  // Adds two new variables to the created data group
  var Var1 = Group.AddVariable("MyVariable", 123);
  var Var2 = Group.AddVarOfArrayType.AddItem("MyText");
  // ...
  
}

VBScript

Sub AddGroupExample

  ' Creates a new data group
  Set Group = ODT.Data.AddGroup("NewDataGroup")
  ' Adds two new variables to the created data group
  Set Var1 = Group.AddVariable("MyVariable", 123)
  Set Var2 = Group.AddVarOfArrayType.AddItem("MyText")
  ' ...
  
End Sub

DelphiScript

function AddGroupExample;
var Group, Var1, Var2;
begin

  // Creates a new data group
  Group := ODT.Data.AddGroup('NewDataGroup');
  // Adds two new variables to the created data group
  Var1 := Group.AddVariable('MyVariable', 123);
  Var2 := Group.AddVarOfArrayType.AddItem('MyText');
  // ...
  
end;

C++Script, C#Script

function AddGroupExample()
{
  // Creates a new data group
  var Group = ODT["Data"]["AddGroup"]("NewDataGroup");
  // Adds two new variables to the created data group
  var Var1 = Group["AddVariable"]("MyVariable", 123);
  var Var2 = Group["AddVarOfArrayType"]["AddItem"]("MyText");
  // ...
  
}

See Also

Group Object
DeleteGroup Method

Highlight search results