Timeout Property (Specific to ProjectSuite Object)

Applies to TestComplete 15.42, last modified on September 08, 2022

Description

The TestItems.Timeout property specifies the timeout of the given test item, that is, its maximum execution time. This is the same value that is displayed in the Timeout column on the Test Items page in the Project Suite Editor.

A zero value for Timeout means that timeout is ignored. If Timeout is greater than 0, when the test item’s execution time exceeds the Timeout value, TestComplete generates the OnTimeout event, stops the item execution and considers the item as failed.

Declaration

ProjectSuite TestItemObj.Timeout

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

Applies To

The property is applied to the following object:

Property Value

An integer that means the timeout of the given test item in minutes.

Example

The following example iterates through a project’s test items and posts their properties to the test log:

JavaScript, JScript

function Test() {
  // Iterates through test items
  for (i = 0; i< ProjectSuite.TestItems.ItemCount; i++) {
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i));
  }
}

function LogTestItemInfo(ATestItem) {
  // Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName);
  // Prints the test item description
  Log.Message(ATestItem.Description);
  // Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log.Message(ATestItem.Timeout);
  Log.PopLogFolder();
}

Python

def Test():
  # Iterates through test items 
  for i in range (0, ProjectSuite.TestItems.ItemCount):
    LogTestItemInfo(ProjectSuite.TestItems.TestItem[i])

def LogTestItemInfo(ATestItem):
  # Prints the test item name 
  Log.AppendFolder(ATestItem.ProjectName)
  # Prints the test item description
  Log.Message(ATestItem.Description)
  # Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation)
  # Determines whether the current test item is enabled 
  Log.Message(ATestItem.Enabled)
  # Obtains the test item's StopOnError property value 
  Log.Message(ATestItem.StopOnError)
  # Prints the test item's timeout 
  Log.Message(ATestItem.Timeout)
  Log.PopLogFolder();

VBScript

Sub Test()
  Dim i
  ' Iterates through test items
  For i = 0 To ProjectSuite.TestItems.ItemCount - 1
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i))
  Next 

End Sub 

Sub LogTestItemInfo(ATestItem)
  ' Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName)
  ' Prints the test item description
  Log.Message(ATestItem.Description)
  ' Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation)
  ' Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled)
  ' Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError)
  ' Prints the test item’s timeout
  Log.Message(ATestItem.Timeout)
  Log.PopLogFolder
End Sub 

DelphiScript

procedure LogTestItemInfo(ATestItem);
begin
  // Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName);
  // Prints the test item description
  Log.Message(ATestItem.Description);
  // Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log.Message(ATestItem.Timeout);
  Log.PopLogFolder();
end;

procedure Test();
var i;
begin
  // Iterates through test items
  for i := 0 to ProjectSuite.TestItems.ItemCount-1 do 
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i));
end;

C++Script, C#Script

function Test()
{
  // Iterates through test items
  for (i = 0; i< ProjectSuite["TestItems"]["ItemCount"]; i++)
  {
    LogTestItemInfo(ProjectSuite["TestItems"]["TestItem"](i));
  }
}

function LogTestItemInfo(ATestItem)
{
  // Prints the test item name
  Log["AppendFolder"](ATestItem.ProjectName);
  // Prints the test item description
  Log["Message"](ATestItem.Description);
  // Prints the corresponding project location
  Log["Message"](ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log["Message"](ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log["Message"](ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log["Message"](ATestItem.Timeout);
  Log["PopLogFolder"]();
}

See Also

Enabled Property (Specific to ProjectSuite Object)
StopOnError Property (Specific to ProjectSuite Object)
OnTimeout Event
Stopping Tests on Timeout

Highlight search results