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 search for the cause of an error in the following way:
-
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.
-
Explore the Details panel of the test log. It provides extended information about the error.
-
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.
-
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.
-
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, simply click the gutter next to the desired line. 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 theVisible
andVisibleOnScreen
properties; to see if an object (window) is enabled or focused, use theEnabled
andFocused
properties.
-
-
The goal of the analysis is to answer 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?
If you cannot determine the cause of an error, send a message to SmartBear’s support team (see Technical Support and Resources). In order for the support team to answer the message in a timely manner, please attach your script 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 script 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.