Posts

TestComplete Tutorial 19 - Adding Objects to the Name Mapping Repository

Image
You can add objects to the Name Mapping repository in several ways: Automatically  when recording and editing tests. Manually  from the screen or from the Object Browser. From scripts . Mapping Objects Automatically By default, TestComplete adds objects to the  Name Mapping  repository  automatically  when you – Record tests, Create  checkpoints , Add or edit keyword test operations. This behavior is controlled by the  Engines > Name Mapping > Map object names automatically   option of TestComplete: If you do not use the Name Mapping repository in your project, you can disable this option to prevent TestComplete from mapping objects. To enable or disable automatic name mapping Select  Tools > Options  from the TestComplete main menu. This will open the  Options  dialog. Select the  Engines > Name Mapping  category. Select or clear the  Map object names automatically  check box. Click  OK  to save the changes. Notes -  Mapping objects automatically during the test recording

TestComplete Tutorial 18 - Creating Snapshots in Object Browser

Image
 TestComplete allows you to store snapshots of your tested application. A snapshot contains complete information about properties, fields and/or methods of an object that you selected and, optionally, of all of its child objects. Creating Snapshots To create a snapshot from the Object Browser - Select the desired object in the object hierarchy displayed in the  Object Browser . Click the    Save Object Snapshot  button on the  Save/Load Snapshots  toolbar. If the toolbar is hidden, right-click somewhere within the TestComplete toolbar or menu area and select  Save/Load Snapshots  from the pop-up list. This will open the Save Object Snapshot dialog. In the dialog specify the snapshot file name and object information the snapshot will contain. Click  OK . To create a snapshot from tests -  Use the  aqObject.SaveObjectSnapshotToFile  method that saves the object snapshot to the specified file. The method takes parameters that specify the object for which you want to create a snapshot, the

TestComplete Tutorial 17 - Object Browser

Image
 Object Browser shows - Running applications The hierarchy of objects in applications Object properties and methods To open the Object Browser, click its tab or select View > Object Browser from the main menu - If needed, you can move the Object Browser to another place within the TestComplete window, or make it a separate window using docking options. Clicking on any running application from Objects panel, we can see the corresponding properties and methods used for application. Selecting each property will give the Description in the bottom Description panel. Also name mapping will also show for selected process in the top 'Selected Object' panel. Exploring Object Hierarchy The Object Browser panel lets you explore the hierarchical structure of processes running in your system. Here is a general view of the hierarchy displayed in the Object Browser: The hierarchical structure represents a tree with the Sys and Mobile objects as the top-level nodes. Each main branch of the

TestComplete Tutorial 16 - How TestComplete searches for mapped objects

Image
 When a test tries to get an object by its alias, TestComplete does the following: In the Mapped Objects tree, it finds an item that corresponds to the alias. Searches for the corresponding object in your system, starting from the top-level item in the Mapped Objects tree and moving down the hierarchy to the target item.It searches for each item on the appropriate level of the application hierarchy. If Extended Find is enabled, it will also search for the item on the following hierarchy levels as well. To find each item, it uses its specified identification criteria. Notes - The object hierarchy in the Aliases tree and in the Mapped Objects tree must not contradict the parent-child relationships of the corresponding objects in the application. Unlike aliases, mapped objects cannot be moved to the topmost hierarchy level. The topmost mapped objects can be Sys or Mobile. You can refer to objects in tests by their names both in the Aliases tree and in the Mapped Object tree. In the latter

TestComplete Tutorial 15 - Aliases and mapped objects

Image
 The Name Mapping repository includes two trees: Mapped Objects (hidden by default) - Shows all the objects (windows, dialogs, pages, and controls) found in your tested application. Typically, the Mapped Object tree matches the application’s object hierarchy. However, for web and mobile applications, it can omit some intermediate levels. The mapped name shows the object position in the Mapped Objects tree: You can use the mapped name to address objects from tests. However, it is more convenient to use aliases for this purpose. Aliases - Objects in the Name Mapping repository can have an alias – a user-friendly name, for example, ButtonOK or linkProducts. Aliases are used to refer to objects in tests. In script tests, you use full aliases, that is, the full hierarchy path of the object in the Aliases tree.  In keyword tests, you do not actually see the full hierarchy path, because TestComplete shows a short notation for easy viewing.  

TestComplete Tutorial 14 - Object identification criteria in Name Mapping

  The object identification criteria that the repository stores and that TestComplete uses to search for objects in the applications can be: Property-value pairs -  For example: ObjectType = Page, URL=http://example.com Conditional expressions -  For example: WndCaption = Open OR Select File Selectors  -  (for web and mobile applications) For web applications, it can be XPath expressions and CSS selectors, for example,  //input[@id='instasearch']  or  #instasearch . For mobile applications, it can be the object class name, accessibility identifier, or an XPath expression, for example,  XCUIElementTypeStatusBar  or  //*[@name="Orders"] . Extended search -  Search for an object on all the levels down the object hierarchy rather than just on the current level. Required child objects -  Search for an object that has specific child objects.

TestComplete Tutorial 13 - Name Mapping

Image
Name Mapping repository The Name Mapping repository stores all the objects of your tested applications that your automated tests use. For each object, the Name Mapping repository has an  alias. alias -  For each object, the Name Mapping repository has an alias. each object also have  the object’s position in the application’s object hierarchy, the criteria by which TestComplete identifies the object in the application uniquely. Note - Each project can have only one Name Mapping repository. To add Name Mapping data from another test project, you can merge the external Name Mapping repository into the local one. Why use name mapping The Name Mapping repository stores object identification information separately from tests making test maintenance easier.  If your application changes, you will not have to change your tests. You will only have to update the Name Mapping repository. You can also specify user-friendly names (aliases) for your tested objects. This way your tests will be shorte