This topic describes typical issues you may come across when testing Qt applications with TestComplete and possible solutions to these issues.
|Tip:||Recording user actions with TestComplete has some specifics that depend on the tested application, its controls and other factors. These specifics include general principles of test recording, as well as specific features used to record actions over menus and toolbars, record keystrokes and user actions over web pages. For a detailed description, see Recording Specifics.|
TestComplete may have problems with getting access to the application’s objects.
Along with the required plugins installed, TestComplete also requires that the following modules of the tested Qt application have their original names (in other words, you must not rename them):
TestComplete uses these files when it accesses the specified application and retrieves information on its objects. So, if you rename any of these files, TestComplete will be unable to obtain information on the application’s internal objects, their methods and properties.
It is also not recommended that you modify these files. For example, the developers may delete unused functions from these files to reduce their size. We do not recommend that you do this, as it may cause problems with recognizing the tested application’s objects. In fact, the deleted functions may be used by TestComplete when it accesses the application’s objects. So, if the needed function is deleted, TestComplete will fail to recognize some objects of the application.
The context menu items and their subitems may be recognized as siblings.
For example, suppose the tested Qt application has a
QtToolButton control that invokes a context menu upon a click, and each context menu item has a number of subitems. When recording a test with TestComplete you may face the following problem: the context menu items and their subitems will be recognized as siblings, so, clicks over them will be recorded as clicks over items of the same level. This behavior is caused by the following reason: invoked subitems are not child items of the button’s context menu items to which they correspond (their
Parent property returns an empty object). In order for tests to be recorded and played back correctly, the tested application’s developer must associate the context menu items with the appropriate subitems in the application.
A control’s popup menu may be recognized incorrectly.
Due to the specifics of Qt applications, it is impossible to determine which menu is a control’s popup menu. Because of this, TestComplete considers the first child menu of a control as its popup menu. If the control has more than one child menu, TestComplete may recognize the popup menu incorrectly. To avoid this, you can use one of the following solutions:
Make sure the popup menu is the only child menu of the control.
QtObjectmethod to refer to the popup menu. To avoid wrong recognition, you should specify the menu name in the
windowsTitleproperty in your Qt application:
In this case, you can get the popup menu by using code that looks like the following: