EnableStackOnFile Property

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

Description

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

Declaration

CallStackSettingsObj.EnableStackOnFile

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 file message posted to the log, or false otherwise.

Remarks

By default, the property’s value is false.

The EnableStackOnFile and EnableStackOnLink properties switch the same internal flag, so you can use both of these properties to enable or disable the call stack tracing for the messages of the file type.

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 a file message is being posted to the test log, posts the file 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 a file message is being posted to the test log
  StackSet.EnableStackOnFile = true;
  // ...
    Log.File("C:\\MyFiles\\FileToTheLog.txt");
  // ...
  // Disables collecting the call stack information
  StackSet.EnableStackOnFile = false;
}

Python

def CallStackSet():
  # Obtains the call stack settings
  StackSet = Log.CallStackSettings
  # Enables collecting the call stack information for the period
  # when a file message is being posted to the test log
  StackSet.EnableStackOnFile = True
  # ...
  Log.File("C:\\MyFiles\\FileToTheLog.txt")
  # ...
  # Disables collecting the call stack information
  StackSet.EnableStackOnFile = False

VBScript

Sub CallStackSet
  ' Obtains the call stack settings
  Set StackSet = Log.CallStackSettings
  ' Enables collecting the call stack information for the period
  ' when a file message is being posted to the test log
  StackSet.EnableStackOnFile = True
  ' ...
    Log.File("C:\MyFiles\FileToTheLog.txt")
  ' ...
  ' Disables collecting the call stack information
  StackSet.EnableStackOnFile = 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 a file message is being posted to the test log
  StackSet.EnableStackOnFile := true;
  // ...
    Log.File('C:\MyFiles\FileToTheLog.txt');
  // ...
  // Disables collecting the call stack information
  StackSet.EnableStackOnFile := 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 a file message is being posted to the test log
  StackSet["EnableStackOnFile"] = true;
  // ...
    Log["File"]("C:\\MyFiles\\FileToTheLog.txt");
  // ...
  // Disables collecting the call stack information
  StackSet["EnableStackOnFile"] = false;
}

See Also

File Method
EnableStackOnLink Property
Test Results
Generic Test Log - Call Stack Panel

Highlight search results