ItemCount Property (Specific to ProjectSuite Object)

Applies to TestComplete 14.93, last modified on October 12, 2021

Description

Use the TestItems.ItemCount property to obtain the total number of projects in the current project suite.

Declaration

ProjectSuite TestItemsObj.ItemCount

Read-Only Property Integer
ProjectSuite TestItemsObj An expression, variable or parameter that specifies a reference to a ProjectSuite TestItems object

Applies To

The property is applied to the following object:

Property Value

The total number of test items.

Example

The following example obtains the total number of project suite test items, iterates through them and posts their names to the test log.

JavaScript, JScript

function Test()
{
  var i, TestItems, Count;
  // Obtains the collection of project suite test items
  TestItems = ProjectSuite.TestItems;
  // Defines the total number of test items in the project suite
  Count = TestItems.ItemCount;
  // Iterates through the project suite’s test items
  for (i = 0; i < Count; i++)
    Log.Message(TestItems.TestItem(i).ProjectName);
}

Python

def Test():
  # Obtains the collection of project suite test items 
  TestItems = ProjectSuite.TestItems
  # Defines the total number of test items in the project suite 
  Count = TestItems.ItemCount
  # Iterates through the project suite's test items 
  for i in range (0, Count):
     Log.Message(TestItems.TestItem[i].ProjectName)

VBScript

Sub Test
  Dim i, TestItems, Count
  ' Obtains the collection of project suite test items
  Set TestItems = ProjectSuite.TestItems
  ' Defines the total number of test items in the project suite
  Count = TestItems.ItemCount
  ' Iterates through the project suite’s test items
  For i = 0 To Count-1
    Log.Message(TestItems.TestItem(i).ProjectName)
  Next
End Sub

DelphiScript

procedure Test();
var i, TestItems, Count;
begin
  // Obtains the collection of project test items
  TestItems := ProjectSuite.TestItems;
  // Defines the total number of test items in the project suite
  Count := TestItems.ItemCount;
  // Iterates through the project suite’s test items
  for i := 0 to Count - 1 do
    Log.Message(TestItems.TestItem(i).ProjectName);
end;

C++Script, C#Script

function Test()
{
  var i, TestItems, Count;
  // Obtains the collection of project suite test items
  TestItems = ProjectSuite["TestItems"];
  // Defines the total number of test items in the project suite
  Count = TestItems["ItemCount"];
  // Iterates through the project suite’s test items
  for (i = 0; i < Count; i++)
    Log.Message(TestItems["TestItem"](i)["ProjectName"]);
}

See Also

Current Property (Specific to ProjectSuite Object)
TestItem Property (Specific to ProjectSuite Object)

Highlight search results