Searching for the Cause of an Error

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

Sometimes, automated tests fail due to the changes made to the tested application or environment, unexpected windows, bugs in the test itself or due to other reasons. You can analyze the test log and your tested application to learn what causes the error.

Goal

The goal of the search is to find the answers to the following questions:

  • What is the difference between the current application state and the state you expect?

  • What is the cause of the error: an error or typo in the script, an application bug or something else?

To search for the cause of an error

  1. Look at the first error in the test log. Depending on the test command being executed, TestComplete can post several error messages to the log. Typically, the first error corresponds to the cause of the problem and subsequent errors were caused by this first error.

  2. Explore the Details panel of the test log. It provides extended information about the error.

  3. To view the test command that was running when the error occurred, double-click the error message in the log. TestComplete will open the test editor and highlight the test command. Explore the test to understand what it performed when the error occurred.

  4. If Test Visualizer is enabled for test runs, explore the images that Test Visualizer captured and posted to the test log. They will help you understand what your application did during the run and whether its behavior or state differs from what you expected.

  5. Run your test once again to analyze the application state when an error occurs. To perform this analysis you can:

    • Set breakpoints on the problematic test lines. To do this, click the gutter next to the desired line.

      Rerun the test. The test engine will automatically pause the test execution on breakpoints. During the pause, you can use the Watch List or Locals panel and the Evaluate dialog to explore test objects and variables’ values (see Debugging Tests - Overview).

    • Enable Test Visualizer for the run. In this case, TestComplete will capture screenshots for user actions and save them to the test log. These screenshots will help you easier understand the state and the behavior of the tested application. To learn how to enable the Visualizer, see Enabling and Disabling Test Visualizer.

    • Add test commands that will post different diagnostic messages to the log, for example:

      • The list of child objects (windows).

      • Images of one or several application windows.

      • The state of objects (windows): existence, visibility, and so on. For instance, to see if an object or window exists, use the Exists property; to see if a window or control is visible, you can use the Visible and VisibleOnScreen properties; to see if an object (window) is enabled or focused, use the Enabled and Focused properties.

If you cannot find the cause of the error

You can send a message to SmartBear support team. For the support team to answer the message in a timely manner, please attach your test and archived results folder of your TestComplete project to the message (the project results folder is normally <Your_Project_Folder>\Log directory). Please modify the test so that it gives detailed information on your application state at the moment of an error: images of application windows, the list of child objects of the tested process, and so on. A small sample application that illustrates the problem will be greatly appreciated.

You can also ask about the problem in our newsgroup or search for a solution in the list of frequently asked questions. For more information on this, see Technical Support and Resources.

See Also

Handling Playback Errors

Highlight search results