GroupCount Property

Applies to TestComplete 15.44, last modified on November 10, 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

Use the Data.GroupCount property to get the total number of existing data groups.

Declaration

DataObj.GroupCount

Read-Only Property Integer
DataObj An expression, variable or parameter that specifies a reference to a Data object

Applies To

The property is applied to the following object:

Property Value

The total number of existing data groups.

Example

The code below obtains the names of all the data groups existing in the current project and then posts these names to the test log.

JavaScript, JScript

function DataGroupCountExample()
{
  // Obtains the total number of groups
  var GroupNum = ODT.Data.GroupCount;
  
  // Iterates through the data groups
  for (var i = 0; i < GroupNum; i++)
  {
    var GrName = ODT.Data.Groups(i).Name;
    // Posts the name of the current group to the test log
    Log.Message(GrName);
  }
     
}

VBScript

Sub DataGroupCountExample

  ' Obtains the total number of groups
  GroupNum = ODT.Data.GroupCount
  
  ' Iterates through the data groups
  For i = 0 to (GroupNum - 1)
    GrName = ODT.Data.Groups(i).Name
    ' Posts the name of the current group to the test log
    Log.Message(GrName)
  Next 
     
End Sub

DelphiScript

function DataGroupCountExample;
var GroupNum, i, GrName;
begin

  // Obtains the total number of groups
  GroupNum := ODT.Data.GroupCount;
  
  // Iterates through the data groups
  for i := 0 to (GroupNum - 1) do
  begin
    GrName := ODT.Data.Groups[i].Name;
    // Posts the name of the current group to the test log
    Log.Message(GrName);
  end;
     
end;

C++Script, C#Script

function DataGroupCountExample()
{
  // Obtains the total number of groups
  var GroupNum = ODT["Data"]["GroupCount"];
  
  // Iterates through the data groups
  for (var i = 0; i < GroupNum; i++)
  {
    var GrName = ODT.Data["Groups"](i)["Name"];
    // Posts the name of the current group to the test log
    Log["Message"](GrName);
  }
     
}

See Also

Groups Property

Highlight search results