TestItems Object (Specific to ProjectSuite Object)

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The TestItems object provides a scripting interface to project suite test items specified on the Test Items page of the Project Suite Editor.

To obtain the collection of a project suite’s test items in scripts, use the TestItems property of the ProjectSuite object.

Members

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

Test Items Page
Project.TestItems

Highlight search results