General recording specifics
When recording user actions, TestComplete takes into account various factors and events that occur in the system and in the application under test. These factors and events affect the test commands that TestComplete records:
-
During recording, TestComplete recognizes windows and controls with which you are working, and records user actions as calls to methods and properties of these objects. If it is impossible to do that, TestComplete resorts to recording mouse clicks with coordinates and keyboard events. Low-level recording like mouse movements or pressing and releasing mouse buttons is also possible, but in many cases it is not so convenient as object-level recording.
-
Depending on the tested application and on its controls, keyboard input can be recorded with the
SetText
orKeys
method call. -
Some third-party software can prevent recording keyboard events.
We recommend that you read the Recording Specifics topic that mentions the points you should pay your attention to and describes possible issues and workarounds. The sections below describe the specifics of recording tests for desktop applications.
Menus and toolbars
-
An application can implement menus using toolbar controls. For instance, the main menu of Windows Explorer is actually a Win32 toolbar control. When you are working with these menus, keep in mind the following:
The operating system opens a menu automatically when the mouse cursor is over the item that provides access to the menu. When recording user actions with toolbar items, click on each item you want to open. Do not use the auto-open feature. Otherwise, the recording may be incorrect.
For example, to record selecting the File > New > Folder menu item in Windows Explorer:
-
Move the mouse to the File item and click this item.
-
Click New in the ensuing submenu.
-
Finally, click Folder in the subsequent sub-submenu.
If your tested application implements menus using standard Win32 menus, you can record menu selections without clicking on each menu item.
To determine how the tested application implements menus, select the application’s main window in the Object Browser, click the ellipsis button of the
MainMenu
property and view theCount
value. If it is 0, then the application implements menus using toolbar controls. -
-
When recording user actions with standard Win32 menu items, do not select menu items using both mouse and keyboard shortcuts at the same time. Use only the mouse or keyboard to work with the menu, otherwise, the recording may be incorrect.
-
If a menu or toolbar item has the OWNERDRAW style, TestComplete uses the item’s index, rather than caption, for recording. This happens because the items with the OWNERDRAW style may not have a caption, so TestComplete uses indexes to record a stable test. See Simulating Menu Actions.
-
TestComplete may record actions against context menu items in Qt applications incorrectly: it may record clicks on context menu items and their subitems as clicks on items of the same level. This happens because the subitems are not associated with the appropriate items.
In order for TestComplete to record menu actions correctly, the tested application’s developers must associate the context menu items and subitems in the application. For detailed information, see Troubleshooting Qt Applications.
Open File and Save File dialogs
-
To select files in the Open File and Save File dialogs, you can use the
OpenFile
andSaveFile
methods. However, TestComplete may fail to record these methods. Instead, TestComplete will record interactions with elements of the Open File or Save File dialog. However, you can modify the recorded test and replace the recorded actions manually with theOpenFile
orSaveFile
method. -
Most applications use the standard Save File dialog to store data to external files. When recording tests, TestComplete records user actions over this dialog as well as over other application windows and dialogs. For example, when you save data to a new file, TestComplete records calling the Save File dialog and specifying the file where the data will be saved. However, if you run your test when the specified file already exists, the dialog will ask whether to replace the existing file with the new one. As the actions over the appeared dialog were not recorded, the test will fail. To avoid this problem, you should also record user actions over the dialog asking whether to replace files or delete the stored file before running the test.
For more information about support for the Save File dialog in TestComplete, see Working With Open File and Save File Dialogs.
Java applications
Due to specifics of the AWT library, TestComplete cannot record actions with menu controls of the java.awt.PopupMenu
class. As a workaround you can:
- Record the needed actions with the Java Application Support plugin disabled.
– or –
- Write the needed script code manually.
– or –
- Use
javax.swing.JPopupMenu
menus instead ofjava.awt.PopupMenu
in your application.
Qt applications
-
Regardless of whether the Record text input into simple editors as radio button is selected or not, for the
QtLineEdit
andQtTextEdit
objects, TestComplete always records text input by using theKeys
method. -
In some cases, TestComplete cannot access objects and their methods in tested Qt applications and cannot record user actions over them. The possible issues are:
-
TestComplete recognizes context menu items and their subitems as siblings (items of the same level). This happens because the subitems are not child items of the context menu items to which they correspond. To solve the problem, you can ask your application's developers to associate the context menu items with the appropriate subitems in the application.
-
TestComplete may fail to access objects, their properties and methods in a tested Qt application if the following modules have been modified or renamed:
-
QtNGui.dll
-
QtNCore.dll
-
and QtNWidgets.dll
Where N is the used Qt version number.
Do not rename or modify these modules.
-
-