Collecting Call Stack Information for Log Messages

Applies to TestComplete 14.30, last modified on November 21, 2019

In TestComplete, tests may call each other. For example, a keyword test may call a script routine or other keyword tests. The call sequences may be rather long and include several levels. If an error occurred somewhere in the test it may be difficult to determine what caused it.

You may double-click the problem message in the test log and jump to the keyword test operation or script statement that posted this message to the log. In addition to this feature, you can use one more instrument to understand what caused the problem: the call stack of executed tests.

During the test run, the test engine can detect and log the sequence of tests that led to posting a message to the test log. After the test run is over, TestComplete will show this sequence in the Call Stack panel of the test log. You can analyze the execution sequence of your tests and better understand what happened in your project during the run.

By default, tracing the call stack is enabled only for error messages, and only the error messages have the Call Stack panel. For other messages, the Call Stack panel is hidden.

You can enable tracing the call stack for messages of other types in your test by using the Log.CallStackSettings object. Use the object’s properties to enable or disable tracking for any available object type. For example, the following code shows how to enable call stack tracing for messages of the warning type:

JavaScript, JScript

Log.CallStackSettings.EnableStackOnWarning = true;

Python

Log.CallStackSettings.EnableStackOnWarning = True

VBScript

Log.CallStackSettings.EnableStackOnWarning = True

DelphiScript

Log.CallStackSettings.EnableStackOnWarning := true;

C++Script, C#Script

Log["CallStackSettings"]["EnableStackOnWarning"] = true;

The test engine will accumulate call stack data for each warning message that you post to the log. After the test run is over, the collected information will be available on the Call Stack panel of warning messages:

Call Stack Panel

Notes:

  • A test can post many messages to the test log. If the call stack tracing is enabled, the collected call stack data may significantly increase the size of the test log files. Therefore, we do not recommend that you enable tracing for all message types. You may even disable the call stack tracing for error messages by using the Log.CallStackSettings.EnableStackOnError property and enable it only when it is needed.

  • The changes you made to the call stack settings only affect one test run, whether you run a test from its editor or from the Project Explorer panel.

    If you run the test as a test item, the changes made to the call stack settings within this test only have effect during the test item execution.

See Also

Posting Messages, Images and Files to the Log
Generic Test Log - Call Stack Panel
Log.CallStackSettings Property
CallStackSettings Object

Highlight search results