Enabled Property (Specific to ProjectSuite Object)

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Use the TestItem.Enabled property to determine whether the given test item is executed when the project suite is run. This property holds True if the test item is checked in the Test Items page of the Project Suite Editor, and False otherwise.

Declaration

ProjectSuite TestItemObj.Enabled

Read-Only Property Boolean
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

True, if the test item is executed during the project suite run; False otherwise.

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

StopOnError Property (Specific to ProjectSuite Object)
Timeout Property (Specific to ProjectSuite Object)
Test Items Page (Project Suite Editor)

Highlight search results