Information in this topic applies to desktop applications only. |
TestComplete includes special functionality that lets you handle freezes of tested applications and find their causes. This topic explain how you can do this:
How Application Freezes Affect the Testing Process
It is quite possible that the tested application stops responding to user actions and to the operating system’s messages. This may cause your tests and TestComplete to hang. A typical example of the situation is when you test an Open Application, call the application’s internal method from your script code or keyword test, and the method never returns a result (for instance, it goes into an infinite loop). In this case, TestComplete also gets hung up, because it waits for the method’s result and does not proceed with the test execution. This may break the entire testing process, because when you run a set of tests, if one of the tests gets hung up, the execution of the rest of the tests in the set gets blocked.
Another typical example is the situation when a call to an application’s internal method displays a modal window, which should be closed by a tester to make the test able to continue running. If the tester cannot do this (for instance, you run automated tests at night), the test gets hung up. If a modal window is expected to appear, you can call the method asynchronously. However, if the window is unexpected, the test will fail (to learn why TestComplete cannot close such unexpected windows automatically in this case, see Calling Methods Asynchronously).
Handling Application Freezes
To handle application hang-ups, use the Freeze Diagnostics properties of your test project. These properties let you specify the applications, whose execution will be monitored by TestComplete during the test run, as well as the time period for detecting a hang. If a monitored application does not respond within the specified time period, the test engine treats it as frozen and performs the following actions:
-
Posts an error message to the test log.
-
Generates an error report and posts a link to the report file to the test log. You can then pass this file to developers, so they can analyze the problem and fix it.
-
Terminates the frozen application.
-
Continues executing the test.
So, if you call an application’s internal method and the application freezes, the call will fail, the test engine will post an error message to the log and will continue the test run. In other words, your tests will not hang.
To view or change the Freeze Diagnostics settings:
-
Switch to the Project Explorer panel. By default, it is on the left of the TestComplete window. If the panel is hidden, select View | Project Explorer from the TestComplete main menu.
-
Right-click your project in the Project Explorer and select Edit | Properties from the context menu. This will open the project editor in the Workspace panel and activate the editor’s Properties page.
-
Select the Freeze Diagnostics option group from the tree on the left of the page.
For information about the settings on this page, see Project Properties - Freeze Diagnostics Options.
It is recommended to narrow down the list of monitored applications as much as possible. Filtering out unnecessary applications improves test performance and avoids situations when off-site applications are recognized as frozen and the test execution is stopped.
Diagnosing Freezes
To find the cause of the freeze and resolve the problem, use the error report generated by TestComplete. This report contains detailed information about the application state at the moment when the error occurred: information about the application's threads and modules, call stacks, memory dumps, and so on. All this data helps developers understand what went wrong and find and fix the cause of the problem faster.
See Also
Project Properties - Freeze Diagnostics Options
Calling Methods Asynchronously
Tracing Exceptions, Crashes and Freezes in Tested Applications