StopOnError Property (Specific to ProjectSuite Object)

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

Description

Use the TestItems.StopOnError property to specify what TestComplete should do when an error occurs during a project run. This scripting property corresponds to the Stop on Error property of the Test Items page.

Declaration

ProjectSuite TestItemObj.StopOnError

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 TestComplete stops the project suite run if the test item execution fails. 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

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

Highlight search results