EnableStackOnEvent Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The EnableStackOnEvent property specifies whether TestComplete will track and save the call stack information for each event message posted to the test log from a keyword test or script routine. The collected data is shown in the Call Stack panel of the test log. Using this information, you can determine the sequence of tests and script routines that led to the execution of the test (or routine) in which the event message was posted.

Declaration

CallStackSettingsObj.EnableStackOnEvent

Read-Write Property Boolean
CallStackSettingsObj An expression, variable or parameter that specifies a reference to a CallStackSettings object

Applies To

The property is applied to the following object:

Property Value

True, if TestComplete should collect the call stack information for each event message posted to the log, or false otherwise.

Remarks

By default, the property’s value is false. You may want to set it to true to trace the call stack of event messages. Note, however, that typically a test posts a lot of event messages to the log, so additional call stack data for each message may significantly increase the size of the test log files.

The changes that you make to the call stack settings have effect only during the execution of one test item or one test (if you run the test from the test editor or the Project Explorer panel). When the next test item starts or when you run the test for the next time, the default settings will be used.

Example

The code below obtains information about the call stack settings, enables collecting the call stack information for the period when an event message is being posted to the test log, posts the event message to the test log and then disables collecting the call stack information.

JavaScript, JScript

function CallStackSet()
{
  // Obtains the call stack settings
  var StackSet = Log.CallStackSettings;
  // Enables collecting the call stack information for the period
  // when an event message is being posted to the test log
  StackSet.EnableStackOnEvent = true;
  // ...
    Log.Event("A sample event message.");
  // ...
  // Disables collecting the call stack information
  StackSet.EnableStackOnEvent = false;
}

Python

def CallStackSet():
  # Obtains the call stack settings
  StackSet = Log.CallStackSettings
  # Enables collecting the call stack information for the period
  # when an event message is being posted to the test log
  StackSet.EnableStackOnEvent = True
  # ...
  Log.Event("A sample event message.")
  # ...
  # Disables collecting the call stack information
  StackSet.EnableStackOnEvent = False

VBScript

Sub CallStackSet
  ' Obtains the call stack settings
  Set StackSet = Log.CallStackSettings
  ' Enables collecting the call stack information for the period
  ' when an event message is being posted to the test log
  StackSet.EnableStackOnEvent = True
  ' ...
    Log.Event("A sample event message.")
  ' ...
  ' Disables collecting the call stack information
  StackSet.EnableStackOnEvent = False
End Sub

DelphiScript

function CallStackSet;
var StackSet;
begin
  // Obtains the call stack settings
  StackSet := Log.CallStackSettings;
  // Enables collecting the call stack information for the period
  // when an event message is being posted to the test log
  StackSet.EnableStackOnEvent := true;
  // ...
    Log.Event('A sample event message.');
  // ...
  // Disables collecting the call stack information
  StackSet.EnableStackOnEvent := false;
end;

C++Script, C#Script

function CallStackSet()
{
  // Obtains the call stack settings
  var StackSet = Log["CallStackSettings"];
  // Enables collecting the call stack information for the period
  // when an event message is being posted to the test log
  StackSet["EnableStackOnEvent"] = true;
  // ...
    Log["Event"]("A sample event message.");
  // ...
  // Disables collecting the call stack information
  StackSet["EnableStackOnEvent"] = false;
}

See Also

Log Message Operation
Event Method
Test Results
Generic Test Log - Call Stack Panel

Highlight search results