Tracing Exceptions, Crashes and Freezes - Overview

Applies to TestComplete 15.47, last modified on January 20, 2023
Information in this topic applies to desktop applications only.

It is quite possible that during testing you may encounter an unexpected behavior of the application under test. The application may stop responding to user actions (freeze), or it may terminate unexpectedly (crash) or an exception can occur in it. It may be hard to reproduce these errors, so it is important that you provide developers with information that will help them find the cause of the problem and fix it. Typically, this information should include the error (or exception) code, call stack (or sequence of function calls that led to an error), memory dump and so on.

TestComplete offers means for tracing errors and collecting the information needed to fix them:

  • Using TestComplete Debug Services
  • Using AQtime and Profile Run Mode
  • Using the Freeze Diagnostics Functionality

Let’s consider these approaches in detail. At the end we will also discuss, which approach to choose.

Using TestComplete Debug Services

TestComplete includes the DbgServices plugin that lets you run tested applications in the Debug mode. You do this by choosing the Debug mode for the application in the Tested Applications editor, or by launching the application with methods of the DbgServices object.

When the tested application runs in Debug mode, TestComplete tracks debug events and exceptions that occur in the tested application. TestComplete posts messages about these events and exceptions to the test log. The extended message contains information relevant to the message. For instance, if an exception occurs, TestComplete saves the call stack for it and displays the call stack information in the Details panel of the log. After the test run is over, you can pass test results containing the call stack to developers in order for them to be able to fix the error.

Note that in order for the test engine to be able to determine and log the routine names and parameters, the tested application must be compiled with debug information.

For more information on tracing exceptions and events in tested applications in Debug mode, see Tracing Events and Exceptions With Debug Services.

Using AQtime and Profile Run Mode

AQtime is SmartBear’s profiler and memory debugger product. TestComplete supports AQtime and lets you run tested application under AQtime. The easiest way to do this is to use the Profile run mode. When you are launching your tested application in this mode, TestComplete is simulating user actions over the application and AQtime is profiling the execution of application’s functions and modules. If an exception occurs, AQtime will unwind the exceptions call stack and provide information about other debug events. For more information, see Tracing Events and Exceptions With AQtime. See also Integration with AQtime.

Running applications in Profile mode is available only if AQtime version 4 or later is installed and the tested application is compiled with debug information.

For more information on tracing applications running in Profile mode, see Integration with AQtime.

Using the Freeze Diagnostics Functionality

TestComplete includes special Freeze Diagnostics options that let you handle application freezes and find their causes. According to these options, TestComplete may generate an error report if an application stops responding to the operating system. Using this report, developers will be able to understand what went wrong and why the application hung. For more information on this, see Diagnosing Application Freezes.

Which Approach to Choose

Using the Debug Services is the simplest way to trace exceptions and to obtain the call stack data when an exception occurs. However, it may be difficult to analyze this call stack, because if the tested application was not compiled with debug information, the call stack will not contain routine names.

Using AQtime and the Profile run mode is convenient, if you already use AQtime to trace your tested application execution (for instance, if you use the Coverage profiler to determine the coverage of your tests, or if you use the Allocation profiler to check for memory leaks). Since AQtime requires the tested application to be compiled with debug information, the call stack data collected by AQtime will contain the routine names and source line numbers.

While Debug Services and AQtime can help only with exceptions, the Freeze Diagnostics feature helps you handle application freezes.

See Also

Tracing Exceptions, Crashes and Freezes in Tested Applications
Handling Exceptions in Scripts
Run Modes and Parameters

Highlight search results